Wednesday, December 10, 2008 at 2:15 PM
Recently we mentioned some updates in the Webmaster Tools GData API: we've just launched a whole new API, the Message Center GData API, as part of the Webmaster Tools API. The Message Center is the way that Google communicates to webmasters important issues regarding their sites—for example, if there's a problem crawling your site, or if someone has requested a change in crawl rate. Until now it was only possible to access these messages through the Message Center section of Webmaster Tools; but now you can also use GData to access it as a feed. This way you don't need to continually check your messages in Webmaster Tools, you can retrieve the messages feed automatically and be informed as soon as possible of any critical issues regarding your site.
What can I do?
The Message Center GData API lets you retrieve all messages, mark the messages as read or unread, and delete messages. You can do these tasks using the provided Java client libraries, or you can create your own client code based on the protocol information.
You can download code samples in Java for all these new features. These samples provide simple ways to use the messages feed. The following snippet shows how to retrieve the messages feed in a supported language and print all the messages:
// Connect with the service and authenticate
WebmasterToolsService service
= new WebmasterToolsService("exampleCo-exampleApp-1");
try {
service.setUserCredentials(USERNAME, PASSWORD);
} catch (AuthenticationException e) {
System.out.println("Username or password invalid");
return;
}
// Retrieve messages feed
MessagesFeed messages;
try {
URL feedUrl;
if (USER_LANGUAGE == null) {
feedUrl = new URL(MESSAGES_FEED_URI);
} else {
feedUrl = new URL(MESSAGES_FEED_URI
+ "?hl=" + USER_LANGUAGE);
}
messages = service.getFeed(feedUrl, MessagesFeed.class);
} catch (IOException e) {
System.out.println("There was a network error.");
return;
} catch (ServiceException e) {
System.out.println("The service is not available.");
return;
}
// Print the messages feed
System.out.println(messages.getTitle().getPlainText());
for (MessageEntry entry : messages.getEntries()) {
if (entry.getRead()) {
System.out.print(" \t");
} else {
System.out.print("new\t");
}
System.out.print(entry.getDate().toUiString() + "\t");
System.out.println(entry.getSubject());
}
Where do I get it?
If you want to know more about GData, you may want to start by checking out the GData website. The homepage of the Webmaster Tools GData API contains a section on the messages feed, with details about the protocol. You can also download the sample Message Center client form the GData download site. It will show you how to use all the Message Center GData API features.
What can I do?
The Message Center GData API lets you retrieve all messages, mark the messages as read or unread, and delete messages. You can do these tasks using the provided Java client libraries, or you can create your own client code based on the protocol information.
- Retrieve messages: The messages feed contains all the messages sent to your account. These messages have important information about your verified sites. Examples of messages include infinite spaces warnings and crawl rate change notifications.
- Mark messages as read or unread: In order to keep track of new communications from Google, you can mark your messages as read or unread, the same way that you would manage your inbox. If you retrieve a single message, this message will be automatically marked as read.
- Delete mesages: It's possible to delete messages using the GData API. However, be careful because if you delete a message through the API it will also be deleted in your Webmaster Tools account, as both interfaces share the same data.
You can download code samples in Java for all these new features. These samples provide simple ways to use the messages feed. The following snippet shows how to retrieve the messages feed in a supported language and print all the messages:
// Connect with the service and authenticate
WebmasterToolsService service
= new WebmasterToolsService("exampleCo-exampleApp-1");
try {
service.setUserCredentials(USERNAME, PASSWORD);
} catch (AuthenticationException e) {
System.out.println("Username or password invalid");
return;
}
// Retrieve messages feed
MessagesFeed messages;
try {
URL feedUrl;
if (USER_LANGUAGE == null) {
feedUrl = new URL(MESSAGES_FEED_URI);
} else {
feedUrl = new URL(MESSAGES_FEED_URI
+ "?hl=" + USER_LANGUAGE);
}
messages = service.getFeed(feedUrl, MessagesFeed.class);
} catch (IOException e) {
System.out.println("There was a network error.");
return;
} catch (ServiceException e) {
System.out.println("The service is not available.");
return;
}
// Print the messages feed
System.out.println(messages.getTitle().getPlainText());
for (MessageEntry entry : messages.getEntries()) {
if (entry.getRead()) {
System.out.print(" \t");
} else {
System.out.print("new\t");
}
System.out.print(entry.getDate().toUiString() + "\t");
System.out.println(entry.getSubject());
}
Where do I get it?
If you want to know more about GData, you may want to start by checking out the GData website. The homepage of the Webmaster Tools GData API contains a section on the messages feed, with details about the protocol. You can also download the sample Message Center client form the GData download site. It will show you how to use all the Message Center GData API features.


9 comments:
Uhm, is there a good reason not to just offer a POP3 or an IMAP interface?
It seems like exactly what these protocols where designed for...
Very nice. I have a few sites and this will be nice. I can't get to it today but I will!
Good news. I think the messages feature needs to be in a more prominent position on the page. Maybe flag the URL on which the problem exists. Nice feature though
Very nice
My suggestions for Google Webmaster
- using microid as a universal authentication method OR
- giving an algorithm for dynamic generation of keys in multiple sites
or at least
- giving a bath of keys (CSV format or similar) for multiple sites.
Great idea to have that opportunity.
Thanks
Why not just email this information?
actually this is a great site....well done bro...all d best !!!!
Hi everyone,
Since over a year has passed since we published this post, we're closing the comments to help us focus on the work ahead. If you still have a question or comment you'd like to discuss, free to visit and/or post your topic in our Webmaster Central Help Forum.
Thanks and take care,
The Webmaster Central Team
Post a Comment