My favorites | English | Sign in

Faster apps faster - GWT 2.0 with Speed Tracer New!

Social Graph API (Labs)

Parser Testing

Contents

  1. About
  2. Usage Policy
  3. URL
  4. Request Parameters
  5. Response Structure
  6. Tools
  7. Questions?

About

As a testing and debugging aid, the Social Graph API includes an API to run any document against the Social Graph API's internal parser to see what it would've parsed, had Googlebot actually crawled it.

You, as a developer, send along the hypothetical URL, Content-Type header, and document body, and the Social Graph API returns the list of parsed attributes and edges.

Note that the included URL is not fetched by Google. This is both to prevent abuse and to support people working on unreleased versions of social websites at unreachable internal addresses (e.g. localhost, 10.0.0.0/8).

Note also that this is still a read-only API. A call to this method is not a recrawl request, doesn't mutate the graph, etc. It's purely a debugging and testing aid.

Back to top

Usage Policy

Use of the testparse method is limited to casual testing during the course of development. Applications shouldn't depend on this method. It's subject to change at any time and isn't as supported as the main lookup method.

Back to top

URL format

To use the Social Graph API test parser, do a POST request to the following URL:

http://socialgraph.apis.google.com/testparse

Back to top

Parameters

The following is a summary of the available POST parameters:

Parameter Type Short Description
url string Required. The hypothetical URL. (will not be crawled; see notes above)
body string Required. The document body.
contentType string Required. The Content-Type header, possibly including a charset.
urlFormat string Optional. One of "raw", "sgn", or "base". Defaults to "base".
  • raw: the raw URLs, untouched
  • sgn: the raw URLs sent through the canonicalization library and left as sgn:// URLs (for known sites, else unchanged)
  • base: like 'sgn', but sgn:// URLs are converted to their canonical http:// form

Back to top

Response Structure

The response is a JSON dictionary with two keys: attributes and edges.

Back to top

Tools

The following are some ready-to-use tools that use this API:

  • Perl script - command line
    That script will download any URL you specify, from your own machine, and then POST it to this API for parsing. The script takes an optional --fakehost=.... option to rewrite the fetched URL's address before posting it, so you can hit, say, http://127.0.0.1:1242/profile.php, but fake the host to be your actual site's URL.
  • Greasemonkey script - requires Greasemonkey
    After installing, you can run it against the page currently loaded in your browser by going to Tools -> Greasemonkey -> User Script Commands -> Validate on Social Graph API.

Back to top

Questions?

Confused about what you're seeing? Find a bug? Have a suggestion? Join the the group mailing list.