4

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": [
  "loboyle@raywhite.com"
 ]
}

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."
 }
}
El Yobo
  • 14,823
  • 5
  • 60
  • 78
  • have you followed https://developers.google.com/site-verification/v1/invoking – Ashesh Kumar Oct 10 '14 at 12:17
  • does your tag manager container on the website match your owner account ? also, i don't see any "id" in your web resource model (would be odd for a post method, but since the identifier is a unique string you might just have to choose it yourself) – Rugdr Oct 10 '14 at 16:58
  • Please provide your code so we can debug the issue. – ProllyGeek Oct 11 '14 at 07:25
  • Sorry, on holiday at the moment with just a phone so can't test or add any details. @ProllyGeek, the debug output above is from Google's own interactive API tester, so no code to site (although my own code generates the same requests and gets the same response). – El Yobo Oct 14 '14 at 08:24
  • @Rugdr, I believe it treats the site identifier as the resource identifier. – El Yobo Oct 14 '14 at 08:26

3 Answers3

0

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

Ryan
  • 295
  • 2
  • 8
  • siteVerification with capital V seems correct. Also I don't think its an authentication issue when a 5xx error code is returned... – Sebastian S Oct 11 '14 at 22:50
  • The capitalization is from their own interactive API tool, so I suspect that's correct. As Sebastian points out, you'd expect a 404 or something else if that was the problem. Other points, yes, the code is there (I can verify via the web interface with no problem), yes I want to verify a site, yes the account is signed in with oauth. – El Yobo Oct 14 '14 at 08:30
  • @ElYobo I did see your github issue you opened. It doesn't seem to be a common problem, however, because they were unable to identify an immediate issue, my guess is there is something case-specific that is causing this. I attempted to use the information you provided with a my registered email, and received the same error, note that this email is in no way linked to that domain. So this is odd... – Ryan Oct 15 '14 at 15:05
0

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).

El Yobo
  • 14,823
  • 5
  • 60
  • 78
0

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

  • Thanks, this might help some people but wasn't the problem in my case; the problem was that high levels of access to the entire tag manager account (not just the affected container) were required in order to successfully verify using tag manager. Hopefully your answer will help some others though. – El Yobo Oct 06 '15 at 21:16