Google's REST API for Search

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 ""

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?

Be sure to read the next Search article: Yahoo's BOSS Advances Search APIs