Les nouveautés et Tutoriels de Votre Codeur | SEO | Création de site web | Création de logiciel





from web contents: Message Center info through our API 2013

salam every one, this is a topic from google web master centrale blog:
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.
  • 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.
How do I do it?
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.

this is a topic published in 2013... to get contents for your blog or your forum, just contact me at: devnasser@gmail.com

Labels:



Leave A Comment:

Powered by Blogger.