9

I want to use Google Webmaster Tool API in c# application. I have gone through different documents that are available on https://developers.google.com. Unfortunately I did not get any working example of using Google WT API using .Net . I have also seen the “Client Libraries” (“https://developers.google.com/gdata/docs/client-libraries”) for this.

Can anybody provide me any working example of how to use Google Webmaster Tool API in c# ?

I have account on Google WT, and want to download .CSV reports for “CrawlErrors”, “InternalLinks”,” TopSearchQueries” etc.

Thanks

noseratio
  • 59,932
  • 34
  • 208
  • 486
  • 1
    According to protocol summary you can do just a few things with protocol: View a list of sites in your account Add and remove sites from your account Verify site ownership Modify site settings Retrieve a list of the keywords Google has found on your site Submit and delete Sitemaps Manage messages sent to your account by Google via the Message Center in Webmaster Tools Retrieve a list of issues Google discovered while crawling your site. so I guess it is not the way to get all reports OR you want to get reports from ANALYTICS instead of webmaster tools – hesar Jan 22 '14 at 12:42

1 Answers1

6

Here you can find the official C# library source code for Webmaster Tools Data API:
http://google-gdata.googlecode.com/svn/trunk/clients/cs/src/webmastertools/

And here you can find examples of usage in the form of unit tests:
http://google-gdata.googlecode.com/svn/trunk/clients/cs/src/unittests/webmastertools/

More specifically, examples of authentication, QuerySites, QuerySitemaps, QueryKeywords, etc.:
http://google-gdata.googlecode.com/svn/trunk/clients/cs/src/unittests/webmastertools/WebmasterToolsServiceTest.cs

Note also there are some bug reports, your mileage may vary: http://productforums.google.com/forum/#!topic/webmasters/gh7vCzYfm6A

If you're still getting 403 Forbidden, the reason behind this might be the 2-Step Verification installed on your Google account. If that's the case, try generating a dedicated password in the Application-specific passwords section of your Google account, and use it with GDataCredentials(this.userName, this.passWord).

Alternatively, you may try adding sub-accounts at https://www.google.com/webmasters/tools/user-admin and use of one of them. The 2-Step Verification concern may apply to those accounts, too.

noseratio
  • 59,932
  • 34
  • 208
  • 486
  • 1
    I ended up getting the login to work by creating an application specific password. AFAIK GWT have shut down a lot of the official API functionality. I managed to write my own code based on a php library. I'll look into the code you referenced for more ideas. Cheers. – Tony McCreath Jan 24 '14 at 05:07
  • 1
    most of the links are dead – hanzolo Mar 14 '17 at 17:18