0
votes

This is a Google Apps for Work account.

It has one primary domain, and one secondary.

It is not believed to have been a primary domain created via Google, but rather directly by GoDaddy and then added to google during the account creation.

Here is the result of the TryItNow call from the Google Developers Directory API page:

PUT https://www.googleapis.com/admin/directory/v1/customers/my_customer?fields=customerDomain&key={YOUR_API_KEY}
{
 "customerDomain": "I PUT MY SECONDARY DOMAIN HERE"
}

Response:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "invalid",
    "message": "Invalid Input"
   }
  ],
  "code": 400,
  "message": "Invalid Input"
 }
}
2
I think in this method you should use your actual customerKey instead of "my_customer". - Gerardo
I will try... But I did use GET on the directory and used my_customer and it worked fine. - Richard Heaton

2 Answers

0
votes

Questions,

1 - Are you a Google Apps reseller? Won't work if so 2 - Was your current primary domain bought through Google on sign up? Won't work if so :( - https://support.google.com/a/answer/6301932

If these aren't the issue then I suspect you've added the domain as an alias rather than a secondary domain. Can you confirm it doesn't say 'Alias' next to the domain inside the 'Domains' tab of your Admin Console?

0
votes

Please make sure you follow this steps,

  • Navigate to the Google Developers article at: https://developers.google.com/admin-sdk/directory/v1/reference/customers/update.
    1. Under "Try it!" select "Authorize requests using OAuth 2.0"
    2. In the "Select OAuth 2.0 scopes" window, click "AUTHORIZE"
    3. In the "customerKey" field, enter: "my_customer" (without quotes)
    4. In the "Request body" field, click the "-- add a property --" drop down
    5. Select "customerDomain"
    6. Enter the secondary domain name that should be set as the primary domain
    7. Click "EXECUTE"
    8. If the primary domain has been renamed successfully, a "200 OK" message will displayed

This should work just fine if you are logged in with the right admin account, you are not a reseller and you don't have any Chrome devices on that domain.

Hope it helps, Radu