Google's documentation states that Users.update will only update fields included in the userResource object. https://developers.google.com/admin-sdk/directory/v1/reference/users/update
In my script, I am able to submit updates successfully, but when I do, fields not specified are cleared out. Here's an example:
Original user resource:
{
orgUnitPath=/,
...
"organizations": [
{
"name": "John",
"title": "developer",
"primary": true,
"department": "IT",
"location": "CA",
"description": "fulltime_employee",
"domain": "acme.com",
"costCenter": "123456"
}]
}
I want to update just one of the fields, title = 'Sr. Developer'. When I submit the partial userResource with Users.update, the rest of the fields within the array element are cleared even though they were not submitted.
Submitted userResource
{
orgUnitPath=/,
...
"organizations": [
{
"title": "sr. developer"
}]
}
Updated user
{
orgUnitPath=/,
...
"organizations": [
{
"name": "",
"title": "sr. developer",
"primary": true,
"department": "",
"location": "",
"description": "",
"domain": "",
"costCenter": ""
}]
}
Is there a way to correct this, or do I need to load each field within the element and submit them all with only the changed fields updated?