Google's REST API for Search

Raymond Yee
Apr. 21 2008, 02:54AM EDT

In the beginning, there was the Google (SOAP) Search API. In December 2006, Google no longer issued any new keys for this API. Those with keys already could still use the API, but it was effectively deprecated.

Then came the Google Ajax Search API. This API was more fully fleshed out but was meant to be used only in browser-based JavaScript to display search results. In contrast, the old Google SOAP Search API had not been tied to browser-based JavaScript applications.

Now, earlier this month, via Google Blogoscoped and BadMagicNumber, comes word that Google added a RESTful supplement to the Ajax Search API to support "Flash and other Non-Javascript Environments:

For Flash developers, and those developers that have a need to access the AJAX Search API from other Non-Javascript environments, the API exposes a simple RESTful interface. In all cases, the method supported is GET and the response format is a JSON encoded result set with embedded status codes. Applications that use this interface must abide by all existing terms of use. An area to pay special attention to relates to correctly identifying yourself in your requests. Applications MUST always include a valid and accurate http referer header in their requests. In addition, we ask, but do not require, that each request contains a valid API Key. By providing a key, your application provides us with a secondary identification mechanism that is useful should we need to contact you in order to correct any problems.

The example search given in the documentation should give you a quick sense of how to use this part of the API. The following command

curl -e http://www.my-ajax-site.com "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=Paris%20Hilton"

returns a JSON object, which you can parse for titles, URLs, and short blurbs.

We can infer from the careful wording in the documentation that the RESTful interface to the the Google Ajax search API is still supposed to be used only for displaying Google search results on a website. Note the insistence on a proper HTTP referer header (implying that the call is from a web application) and the reference to the API's terms of use.

In order words, we've come from a SOAP based search API that was limited to personal, non-commercial use that nonetheless wasn't tied to web applications to the current manifestation of an Ajax and RESTful API that is open for restricted commercial use tied to displaying search results on the Web. What's next?

Raymond Yee

Comments

Comments(7)

User HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

I don't know if we can call it an API as it is not documented at all. The documentation includes a paragraph that's an _example_ of how to use a specific part of the 'API'. However the API itself is not documented. What are the URLs to send requests to? OK, the example contains it for the web search. How about the others? I'm looking for the local search API doc and I can't seem to find any information about that. I was lucky enough to find the URL in some example on some site (use /local instead of /web in the example above), but I wouldn't call something an interface that's not documented. Sure, you can revesre engineer it by using a proxy, but still... :(

Good day! This is kind of off topic but I need some guidance from an established blog. Is it tough to set up your own blog? I'm not very techincal but I can figure things out pretty fast. I'm thinking about creating my own but I'm not sure where to start. Do you have any points or suggestions? Cheers <a href="http://www.finanzierungsrechnerimmobilien.de/finanzierungsrechner-immobi... rel="nofollow">immobilienkreditrechner</a>