Google webmaster API

27 views
Skip to first unread message

cslinux

unread,
Sep 12, 2008, 1:35:38 PM9/12/08
to Google Data Protocol
I'm asking if i can use php client library with Google webmaster tools
api, cause i only found a reference guide for java, that's why I'm
asking, even the php client lib has no webmaster tool sample, in case
the google webmaster api isn't supported in the php lib, what could be
a good start in order to implement the api in php ?

Eric (Google)

unread,
Sep 12, 2008, 2:33:52 PM9/12/08
to Google Data Protocol
I would recommend taking a look at the Webmaster Tools Protocol Guide:
http://code.google.com/apis/webmastertools/docs/developers_guide.html

And using PHP libcurl:
http://code.google.com/apis/gdata/articles/using_cURL.html

And just a heads up, AuthSub tokens are currently broken with
Webmastertools:
http://code.google.com/p/gdata-issues/issues/detail?id=678&colspec=API%20ID%20Type%20Status%20Priority%20Stars%20Summary

Eric

cslinux

unread,
Sep 12, 2008, 3:01:35 PM9/12/08
to Google Data Protocol
So do you mean that i can't yet use AuthSub for webmastertools which
means i can't use the api for web application ?

On Sep 12, 9:33 pm, "Eric (Google)" <api.e...@google.com> wrote:
> I would recommend taking a look at the Webmaster Tools Protocol Guide:http://code.google.com/apis/webmastertools/docs/developers_guide.html
>
> And using PHP libcurl:http://code.google.com/apis/gdata/articles/using_cURL.html
>
> And just a heads up, AuthSub tokens are currently broken with
> Webmastertools:http://code.google.com/p/gdata-issues/issues/detail?id=678&colspec=AP...

Eric (Google)

unread,
Sep 12, 2008, 3:08:52 PM9/12/08
to Google Data Protocol


On Sep 12, 12:01 pm, cslinux <mina.ram...@gmail.com> wrote:
> So do you mean that i can't yet use AuthSub for webmastertools which
> means i can't use the api for web application ?

Correct. Unless you use ClientLogin for now.

Mina Ramses

unread,
Sep 12, 2008, 3:13:18 PM9/12/08
to google-he...@googlegroups.com
Did you try the AuthSub ..?, didn't you report it to google support ?
Can i use ClientLogin to work with a webpage ...? or no way ?
Thanks in advance and kind regards.

--
|Mina r. Fahmy|
===============================================================
Key ID: 0x964F ED94 on --keyserver http://wwwkeys.eu.pgp.net
Key fingerprint = 35DD 3279 EB3E A711 1205 466F 4B8E 4940 964F ED94
===============================================================

Mina Ramses

unread,
Sep 12, 2008, 3:23:37 PM9/12/08
to google-he...@googlegroups.com
I checked http://code.google.com/p/gdata-java-client/issues/list
I didn't find anyone with this issue, that's why i'm asking how AuthSub tokens are broken and this is only with webmaster tools api or all google data api ?
I think people are working on it , which means they didn't use AuthSub ??

Eric (Google)

unread,
Sep 12, 2008, 4:37:27 PM9/12/08
to Google Data Protocol
This is only an issue with Webmaster Tools. Not with the other Data
APIs.

This is under the general Google Datas issue tracker:
http://code.google.com/p/gdata-issues/issues/detail?id=678

To answer your last question, it's possible to write a web app
that uses ClientLogin, but it's strongly discouraged. Sharing
a user's credentials in a web app isn't a great idea.

Eric

On Sep 12, 12:23 pm, "Mina Ramses" <mina.ram...@gmail.com> wrote:
> I checkedhttp://code.google.com/p/gdata-java-client/issues/list
> I didn't find anyone with this issue, that's why i'm asking how AuthSub
> tokens are broken and this is only with webmaster tools api or all google
> data api ?
> I think people are working on it , which means they didn't use AuthSub ??
>
>
>
> On Fri, Sep 12, 2008 at 10:13 PM, Mina Ramses <mina.ram...@gmail.com> wrote:
> > Did you try the AuthSub ..?, didn't you report it to google support ?
> > Can i use ClientLogin to work with a webpage ...? or no way ?
>
> > Key ID: 0x964F ED94 on --keyserverhttp://wwwkeys.eu.pgp.net
> > Key fingerprint = 35DD 3279 EB3E A711 1205 466F 4B8E 4940 964F ED94
> > ===============================================================
>
> Thanks in advance and kind regards.
> --
> |Mina r. Fahmy|
> ===============================================================
> Key ID: 0x964F ED94 on --keyserverhttp://wwwkeys.eu.pgp.net

Mina Ramses

unread,
Sep 17, 2008, 12:10:17 PM9/17/08
to google-he...@googlegroups.com
Hi Eric,
Also i want to ask , if there's no other ways to implement a webmaster tools web application without using this AuthSub but in a correct way and with no problems ? i.e bypass the AuthSub authentication by any way.
Key ID: 0x964F ED94 on --keyserver http://wwwkeys.eu.pgp.net

Eric (Google)

unread,
Sep 17, 2008, 12:46:16 PM9/17/08
to Google Data Protocol
As I mentioned, there's ClientLogin.

Here's the Google Data Overview on it:
http://code.google.com/apis/gdata/auth.html#ClientLogin

and a Java Webmastertools example:
http://code.google.com/apis/webmastertools/docs/developers_guide_java.html#client_login

Eric

Mina Ramses

unread,
Sep 17, 2008, 12:52:19 PM9/17/08
to google-he...@googlegroups.com
Thanks Eric for your fast reply,
I know about ClientLogin, but I'm asking if can i use it without any problems to build a web application ?
Key ID: 0x964F ED94 on --keyserver http://wwwkeys.eu.pgp.net

Eric (Google)

unread,
Sep 17, 2008, 1:18:48 PM9/17/08
to Google Data Protocol
Use whatever authentication method you wish,
but here's why we discourage ClientLogin in webappss:

1.) You need to deal with CAPTCHAs

2.) A users credentials are exposed to your app. From a security
perspective, it's much better for them to input this information on a
Google page rather than a third party app.

3.) ClientLogin tokens expire after ~2weeks. AuthSub/OAuth tokens
do not expire.

Eric

On Sep 17, 9:52 am, "Mina Ramses" <mina.ram...@gmail.com> wrote:
> Thanks Eric for your fast reply,
> I know about ClientLogin, but I'm asking if can i use it without any
> problems to build a web application ?
>
>
>
> On Wed, Sep 17, 2008 at 7:46 PM, Eric (Google) <api.e...@google.com> wrote:
>
> > As I mentioned, there's ClientLogin.
>
> > Here's the Google Data Overview on it:
> >http://code.google.com/apis/gdata/auth.html#ClientLogin
>
> > and a Java Webmastertools example:
>
> >http://code.google.com/apis/webmastertools/docs/developers_guide_java...

Mina Ramses

unread,
Sep 17, 2008, 3:15:22 PM9/17/08
to google-he...@googlegroups.com
Another question please if you don't mind .
Regarding the Java Webmastertools example, i think it's a java code, so i'm asking to use it in implementing a web application can I use this code as jsp pages ? or must i use another client library for web application implementation ?
I checked the php client library but i didn't find a support for the webmaster tools api or any samples , correct me if I'm wrong.
Thanks in advance Eric and kind regards


--
|Mina r. Fahmy|
===============================================================
Key ID: 0x964F ED94 on --keyserver http://wwwkeys.eu.pgp.net

Eric (Google)

unread,
Sep 17, 2008, 3:23:29 PM9/17/08
to Google Data Protocol


On Sep 17, 12:15 pm, "Mina Ramses" <mina.ram...@gmail.com> wrote:
> Another question please if you don't mind .
> Regarding the Java Webmastertools example, i think it's a java code, so i'm
> asking to use it in implementing a web application can I use this code as
> jsp pages ? or must i use another client library for web application

Yes. You can use the library to create .jsp pages.

> implementation ?
> I checked the php client library but i didn't find a support for the
> webmaster tools api or any samples , correct me if I'm wrong.

Correct, there's no support in the PHP lib.

Mina Ramses

unread,
Sep 17, 2008, 3:34:10 PM9/17/08
to google-he...@googlegroups.com
Any guide to use the java lib. in jsp pages , any type of guide ... ?
Thanks in advance and kind regards


--
|Mina r. Fahmy|
===============================================================
Key ID: 0x964F ED94 on --keyserver http://wwwkeys.eu.pgp.net

Eric (Google)

unread,
Sep 22, 2008, 1:40:29 AM9/22/08
to Google Data Protocol


On Sep 17, 12:34 pm, "Mina Ramses" <mina.ram...@gmail.com> wrote:
> Any guide to use the java lib. in jsp pages , any type of guide ... ?

I'm afraid not. You'll have to search the web for tutorials on
creating
JSP pages.

You could try modifying the Google Health JSP sample app to work
with Webmaster tools. That uses the the Google Data Java client:
http://code.google.com/p/googlehealthsamples/source/browse/#svn/trunk/java/health_sample

I would also have a look at the WT Java Developer's Guide:
http://code.google.com/apis/webmastertools/docs/developers_guide_java.html

Eric

Mina Ramses

unread,
Sep 30, 2008, 6:50:13 PM9/30/08
to google-he...@googlegroups.com
I'm asking if i can use the python client library to implement a webmaster tools web application, i.e to use the library for web-based application and which requirements does this implementation exactly needs (i.e any specific framework, libraries, specific version of python or specific web application engine...etc), also i want to know if Google application engine is with any relation to my inquiry, i checked it but i didn't get its purpose clearly enough.

Mina Ramses

unread,
Oct 17, 2008, 4:32:29 PM10/17/08
to google-he...@googlegroups.com
I used to write a jsp for webmasterTools  as the following :
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="com.google.gdata.client.webmastertools.WebmasterToolsService,
                 com.google.gdata.data.OutOfLineContent,
                 com.google.gdata.data.webmastertools.CrawlRate,
                 com.google.gdata.data.webmastertools.DomainPreference,
                 com.google.gdata.data.webmastertools.SitesEntry,
                 com.google.gdata.data.webmastertools.SitesFeed,
                 com.google.gdata.util.AuthenticationException,
                 com.google.gdata.util.ServiceException,
                 java.text.*,
                 java.io.IOException,
                 java.net.MalformedURLException,
                 java.net.URL,
                 java.net.URLEncoder
                 " %>   
                
                 <%!
private static final String FEED_URI_BASE
= "http://www.google.com/webmasters/tools/feeds/";

private static final String SITES_FEED_DIRECTORY = "sites/";


private static URL getSitesFeedUrl() throws IOException {

            try {

              return new URL(FEED_URI_BASE + SITES_FEED_DIRECTORY);

            } catch (MalformedURLException e) {

              throw new IOException("URL for sites feed is malformed.");

            }

          }

public static void printUserSites(WebmasterToolsService myService)
throws ServiceException, IOException {
try {
System.out.println("Printing user's sites:");

// Request the feed
URL feedUrl = getSitesFeedUrl();
SitesFeed sitesResultFeed = myService.getFeed(feedUrl, SitesFeed.class);

// Print the results
for (SitesEntry entry : sitesResultFeed.getEntries()) {
  System.out.println("\t" + entry.getTitle().getPlainText());
}
} catch (MalformedURLException e) {
throw new IOException("URL for sites feed is malformed.");
}
}
private static void usage() {
    System.out.println("Usage: WebmasterToolsClient --username <username>"
        + " --password <password>");
    System.out.println("\nA simple application that lists sites, "
        + "and Sitemaps using the provided username and "
        + "password for authentication.");
  }
 
public static void runExamples(WebmasterToolsService myService)
throws ServiceException, IOException {
printUserSites(myService);
}

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<%
WebmasterToolsService myService = new WebmasterToolsService("exampleCo-exampleApp-1");
try {
  myService.setUserCredentials("user", "password");
} catch (AuthenticationException e) {
  System.out.println("The username or password entered are not valid");
  System.exit(1);
}
System.out.println("Running with user ");

// Run the example methods, list sites, insert, update, etc.
try {
  runExamples(myService);
} catch (ServiceException e) {
  e.printStackTrace();
} catch (IOException e) {
  e.printStackTrace();
}
System.out.println("Sample run completed.");
%>

</body>
</html>



But i got the following errors :
"Only a type can be imported. com.google.gdata.client.webmastertools.WebmasterToolsService resolves to a package"

the WebmasterToolsService , ServiceException, SitesFeed  ...etc cannot be resolved to a type at the time i used to import com.google.gdata.client.webmastertools.WebmasterToolsService, com.google.gdata.util.ServiceException, com.google.gdata.data.webmastertools.SitesFeed , ....etc
so what's wrong ?
I want to mention that i'm using eclipse and i did add all these external libs .
Any comment ?

Jeff Fisher (Google)

unread,
Oct 17, 2008, 5:21:14 PM10/17/08
to Google Data Protocol
Webmaster Tools is supported out of this group:

http://groups.google.com/group/Google_Webmaster_Help

Cheers,
-Jeff
> On Mon, Sep 22, 2008 at 7:40 AM, Eric (Google) <api.e...@google.com> wrote:
>
> > On Sep 17, 12:34 pm, "Mina Ramses" <mina.ram...@gmail.com> wrote:
> > > Any guide to use the java lib. in jsp pages , any type of guide ... ?
>
> > I'm afraid not.  You'll have to search the web for tutorials on
> > creating
> > JSP pages.
>
> > You could try modifying the Google Health JSP sample app to work
> > with Webmaster tools.  That uses the the Google Data Java client:
>
> >http://code.google.com/p/googlehealthsamples/source/browse/#svn/trunk...
>
> > I would also have a look at the WT Java Developer's Guide:
> >http://code.google.com/apis/webmastertools/docs/developers_guide_java...
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages