2

The Google Directory API https://developers.google.com/admin-sdk/directory/v1/reference/users/get returns following kind of organizations data for a User. However in the Apps Admin console I can not find where the corresponding organisations name "Company Title" is defined. From where does it come from or how to edit that data? This is also inconsistent, since for some Users in this same domain the "name" field is missing completely?

"organizations": [
 {
   "name": "Company Title",
   "title": "Software Developer",
   "primary": true,
   "type": "work",
   "department": "The SW department"
 }
],
JariK
  • 161
  • 1
  • 12
  • Apparently the main confusion is that the `primary` `organization` record in the list of `organizations` can not just be modified in Google Apps Admin console. You can mainly edit `title` and `department` However Apps with decent rights (scopes) to use Admin SDK can modify these fields freely via Directory API. And that is the source of confusion in this case. – JariK Sep 21 '16 at 04:43
  • I wonder whether you ever got to the bottom of this. I seem to be having the same issue in 2021! – user2294382 Jun 25 '21 at 11:29

1 Answers1

2

I'm not particular about the Apps Admin console but you can update a user account if there are data that has to be changed.

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

You can try the REST API to retrieve all or children organization units.

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

Here is a sample response to the List of Org unit/s

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

You can also try using the Update an organization unit:

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

You can compare the values in the REST API and Admin Console.

Hope it helps!

Mr.Rebot
  • 6,703
  • 2
  • 16
  • 91
  • Thanks, I forgot to mention that yes via Directory API it is possible to modify User account data. Actually the list of `organizations` and `orgUnitPath` does not relate to each other `organizations` is more like personal data title, department, etc... and there can be several / User `orgUnitPath` links to `orgUnits` which does not link to the list of `organizations` Looks like the main confusion actually is that Apps Admin console does not allow to edit all the fields of `primary` `organization` in List of organizations. These can be modified by Directory API, with decent rights. – JariK Sep 21 '16 at 04:37