google-admin-sdk - 目录 API,用户组织 - 名称字段。它从何而来?

标签 google-admin-sdk google-directory-api

Google Directory API https://developers.google.com/admin-sdk/directory/v1/reference/users/get 返回用户的以下类型的组织数据。但是,在应用程序管理控制台中,我找不到定义相应组织名称“公司名称”的位置。它从哪里来或如何编辑该数据?这也是不一致的,因为对于同一域中的某些用户,“名称”字段完全丢失?

"organizations": [
 {
   "name": "Company Title",
   "title": "Software Developer",
   "primary": true,
   "type": "work",
   "department": "The SW department"
 }
],

最佳答案

我对应用管理控制台并不挑剔,但如果有数据需要更改,您可以更新用户帐户。

To update a user account, use the following PUT request and include the authorization described in Authorize requests. The userKey can be the user's primary email address, the unique user id, or one of the user's alias email addresses. For the request and response properties, see the API Reference.

PUT https://www.googleapis.com/admin/directory/v1/users/userKey

您可以尝试使用 REST API 检索所有或子组织部门。

To retrieve all sub-organization units under an organization unit or to retrieve the immediate children sub-organization units under an organization unit, use the following GET request and include the authorization described in Authorize requests. For the request and response properties, see the API Reference.

GET https://www.googleapis.com/admin/directory/v1/customer/my_customer
/orgunits?orgUnitPath=full org unit path&type=all or children

这是对组织单位列表的响应示例

{
    "kind": "directory#orgUnit",
    "name": "sales",
    "description": "The corporate sales team",
    "orgUnitPath": "/corp/sales",
    "parentOrgUnitPath": "/corp",
    "blockInheritance": false
     }

您还可以尝试使用更新组织部门:

To update an organization unit, use the following PUT request and include the authorization described in Authorize requests. For the request and response properties, see the API Reference:

PUT https://www.googleapis.com/admin/directory/v1/customer/customerId/orgunits/orgUnitPath

您可以比较 REST API 和管理控制台中的值。

希望对你有帮助!

关于google-admin-sdk - 目录 API,用户组织 - 名称字段。它从何而来?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39571207/

相关文章:

java - 带有空格和通配符的 Google 目录服务查询 : behavior not matching expectations

batch-processing - 使用 Google Directory API 配置数千个用户

python - 使用 Python 的服务帐户 Google 用户列表

google-api - 确定用户是否为组成员

google-apps-script - 以编程方式启用 "Allow less secure apps"?

google-api - 谷歌管理员 SDK 目录 API : Adding group as member with role "OWNER" gets error

android - 谷歌地图检查坐标是否在两点之间

python - 使用服务帐户的 Doubleclickbid 管理器 API

swift - 添加自定义路径以包含在 Google Directions API 中