Google Verification API 503

1k Views Asked by At

The google verification api is giving me a 503 error "An unexpected error occurred. Please try your request again." whenever I try to verify a domain using the TAG_MANAGER method.

This occurs when I try to use the API via the PHP client library and also when I use Google's API explorer. However, if I log in to Google Webmaster Tools and add the site, using Tag Manager as the verification method, I am able to successfully verify myself.

I've attached debugging information from the API explorer below, but it's very light on detail. My support request in the webmaster central forum has been met with deafening silence, but I'm not sure where else to ask.

Request


POST https://www.googleapis.com/siteVerification/v1/webResource?verificationMethod=TAG_MANAGER&key={YOUR_API_KEY}

Content-Type:  application/json
Authorization:  Bearer ya29.iAC-QBa-7nzvS2lpFFmfcej2Y0suhiWHgS8SivKN9jpYWffljsRV7rbL
X-JavaScript-User-Agent:  Google APIs Explorer

{
 "site": {
  "identifier": "http://unit1-28leanyerdriveleanyer.com",
  "type": "SITE"
 },
 "owners": [
  "[email protected]"
 ]
}

Response


503 Service Unavailable

- Show headers -

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "backendError",
    "message": "An unexpected error occurred. Please try your request again."
   }
  ],
  "code": 503,
  "message": "An unexpected error occurred. Please try your request again."
 }
}
3

There are 3 best solutions below

0
On BEST ANSWER

I finally stumbled across the fix for this today. The problem was that the service account running the requests needs to have "View and Manage" permissions on the applicable Tag Manager account, not just on the container that is actually being used. Only view access is required to the actual container.

While this isn't exactly desirable (we have 20+ containers for different sites/applications within the one account), it does resolve the problem and allow the Tag Manager site verification to work as intended.

I'm not sure whether the documentation has been changed since I originally had this problem or whether I just missed it. The required permissions are unexpected and the response code is misleading (a 403 would make more sense).

1
On

Check if you've enabled "Maintenance Mode" on your domain you're trying to verify using Google. Disable it and you're done.

3
On

https://www.googleapis.com/siteVerification/v1/webResource?verificationMethod=TAG_MANAGER&key={YOUR_API_KEY}

may need to be

https://www.googleapis.com/siteverification/v1/webResource?verificationMethod=TAG_MANAGER&key={YOUR_API_KEY}

also, a few additional notes

For Google to use your Google Tag Manager container snippet code for Webmaster Tools verification, the code must be placed immediately after the opening tag of your page.

The method you provided is used for verifying a site or domain, be sure you intend to verify a site, because this is what your request currently contains.

This method requires you to be authenticated (OAuth 2.0) http://code.google.com/apis/accounts/docs/OAuth2.html

Ensure you have visited the following link http://www.google.com/tagmanager/features.html