1

The Webmaster Tools API requires a SiteID for most operations.
This SiteID is a Url Encoded version of the site's url, as appears in the Google Webmaster Tools dashboard.

So why does the next URL doesn't work (the dreaded "Bad Request", or "Site Not Found")?

var site = "http://example.com/";
var urlEncoded = HttpUtility.UrlEncode(site);
var url = "https://www.google.com/webmasters/tools/feeds/" + urlEncoded + "/crawlissues/";
seldary
  • 6,186
  • 4
  • 40
  • 55

1 Answers1

1

Google expects upper case letters for the encoded characters, while HttpUtility.UrlEncode produces lower case characters.

See this answer for a "selective ToUpper" method implementation.

(Another thing, the last slash might make a difference! http://x.com/ is not http://x.com)

Community
  • 1
  • 1
seldary
  • 6,186
  • 4
  • 40
  • 55
  • Is it the real issue? How do you get crawlissues? Do you use Gdata? Can you share your code if you managed to make it work? – Burjua Dec 20 '12 at 12:08
  • Actually, I just encountered this while spiking various Google APIs, and thought I'll share this weird behavior. I ended up using only the https://www.googleapis.com/analytics/v3 API. the "crawlissues" was just an example for something you can get from this API. – seldary Dec 20 '12 at 13:29
  • googleapis.com/analytics/v3 link does not work. Can anyone share some C# code to get crawl issues? – Mithil Feb 14 '13 at 17:00