Google’s REST API for Search

Raymond Yee, April 21st, 2008

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?

Tags: Google, Search
Both comments and pings are currently closed.

7 Responses to “Google’s REST API for Search”

April 21st, 2008
at 3:37 am
Comment by: Brian Mingus

My SOAP API key still works.

April 21st, 2008
at 7:22 am
Comment by: Franz

hi, here is an easy example how powerful this kind of toy / api can be.

have fun
http://www.creativspace.at/?q=site%3Anichtlustig.de&safe=on

April 21st, 2008
at 8:02 am
Comment by: Dew Drop - April 21, 2008 | Alvin Ashcraft's Morning Dew

[...] Google’s REST API for Search (Raymond Yee) [...]

April 21st, 2008
at 4:42 pm
Comment by: rascunho » Blog Archive » links for 2008-04-21

[...] Google’s REST API for Search 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 [...]

May 30th, 2008
at 5:06 am
Comment by: franz

another project which uses the rest api
http://www.facesaerch.com/

September 12th, 2008
at 1:40 pm
Comment by: atleta

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… :(

December 15th, 2011
at 8:23 am
Comment by: Finanzierungsrechner Immobilien

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 immobilienkreditrechner

Follow the PW team on Twitter

ProgrammableWeb
APIs, mashups and code. Because the world's your programmable oyster.

John Musser
Founder, ProgrammableWeb

Adam DuVander
Executive Editor, ProgrammableWeb. Author, Map Scripting 101. Lover, APIs.