5

I'm trying to use the Directory API to update a customer object, but attempting to modify anything at the top-level results in a 400 (Invalid Customer Language) error being returned.

Here's the get of the initial object (some items redacted for privacy)

Request

GET https://www.googleapis.com/admin/directory/v1/customers/<customerID>

Response

200 OK
{
 "kind": "admin#directory#customer",
 "id": "<customerID>",
 "etag": "\"<etag>\"",
 "customerDomain": "<domainName>",
 "alternateEmail": "<email>",
 "postalAddress": {
  "contactName": "<name>",
  "organizationName": "",
  "locality": "<city>",
  "region": "<state>",
  "countryCode": "US",
  "addressLine1": "<address1>",
  "addressLine2": "",
  "addressLine3": "",
  "postalCode": "<zip>"
 },
 "phoneNumber": "<phoneNumber>",
 "language": "en",
 "customerCreationTime": "2011-03-31T03:45:49.408Z"
}

Attempting to then update the phone number or language individually results in the error. It doesn't matter if I use a patch or update call.

Phone Number patch call:

{
  "phoneNumber": "+18005551234"
}

Language patch call:

{
  "language": "en-GB"
}

Patch or Update call response

400 OK
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "invalid",
    "message": "Invalid Customer language"
   }
  ],
  "code": 400,
  "message": "Invalid Customer language"
 }
}

Right now I'm just playing with the online tools (https://developers.google.com/admin-sdk/directory/v1/reference/customers/patch), before I pull it into code. I've not found anything in the docs, forums, issue tracker, or on here that addresses the issue; any assistance would be much appreciated!

Gosherm
  • 81
  • 4

2 Answers2

3

Looks like it's a bug with the online tools. I was able to successfully manipulate the object using an update version of GAM (https://github.com/jay0lee/GAM), and am ready to move forward. I'll leave this here in case anyone else runs across the problem.

Gosherm
  • 81
  • 4
0

Using PUT request works for me, in node-sdk I have something like this:

  google.admin('directory_v1').customers.update({  
    auth: auth,               
    customerKey: 'my_customer'
    resource: {               
      customerDomain: 'some-domain',
    }                         
  }, function(err, response) {
     // Some code
  }
Laith Shadeed
  • 4,271
  • 2
  • 23
  • 27