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. TheuserKey
can be the user's primary email address, the unique userid
, 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/