Previous Page
Next Page

Programming with the Google Webs API

Of all the APIs and development tools that Google makes available, the most popular is the Google Webs API. This API lets you incorporate Google web search into the web pages and applications you develop, so your users can search all or part of the Web directly from the application.

The Google Webs API is a web service that uses SOAP and WSDL standards. You can use the Google Webs API to develop applications in whatever programming environment you preferJava (Apache SOAP and Apache Axis), Perl (SOAP::Lite), Ruby (SOAP4R), or C# in Microsoft Visual Studio .NET. The programs you develop use SOAP to connect remotely to the Google Webs API service, and thus return search results from the Google web index.

Note

SOAP stands for Simple Object Access Protocol, and is an XML-based mechanism for exchanging information between different operating environments. WSDL stands for Web Services Description Language, and is used to describe how to interface with XML-based services.


Types of Google-Based Applications

By using the Google Webs API, you can add all sorts of functionality to your applications. You can enable your program to automatically issue search requests to Google's web index (or have users search manually), and then receive results as structured data in whatever format you specify. You can have your applications access historical data in the Google cache. You can even use the Google Webs API as a spell checker. (As you recall, Google has built-in spell-checking features.) Bottom line, the Google Webs APIs support the exact same search syntax as does the standard Google web search, so anything you can do from the Google website, you can do from within your applications.

What types of applications can you write using the Google Webs API? Here are a few ideas from the folks at Google:

  • Market research. A program that regularly monitors the Web to display new information about a given subject

  • Data analysis. A program that lets users analyze real-time information retrieved from the web, such as stock market quotes, news headlines, and the like

  • Trend analysis. A program that retrieves and analyzes the amount of information available on a subject over time

  • Search interface. A program that lets the user search for information using a non-HTML interface

  • Spell checking. A program that incorporates Google's spell-checking function

That's just the tip of the iceberg, of course. Recognizing just how much information Google puts at your fingertips, how you incorporate that information into your applications (using the Google Webs API) is up to you.

Note

At present, the Google Webs API can only be used to query the main Google web page index. It cannot be used to query Google Image Search, Google Groups, or the Google Directory.


Using the Google Webs API

To develop with the Google Webs API, you go through the following process:

1.
Go to the Google Web APIs page (www.google.com/apis) and download the developer's kit. (The developer's kit includes all the documentation and example code you need to start programming with the Google Webs API.)

2.
Click the link to create a Google Account (or sign into an existing account) and create a license key. The license key is then emailed to you.

3.
Write your program code, incorporating hooks into the Google Webs API. Your code must also include your license key with each query you submit to the Google Webs API service.

Tip

Get help and advice from other developers and the occasional Google employee at the google.public.web-apis Google Group (groups.google.com/group/google.public.web-apis). Some other good sources of information about using the Google Webs API are the books Mining Google Web Services: Building Applications with the Google API, by John Paul Mueller (Sybex, 2004), and Google Hacks, by Tara Calishain and Rael Dornfest (O'Reilly, 2005).


The Google Webs API developer's kit includes a WSDL file describing the Google Web APIs service, a custom Java client library, documentation on how to use the service with Microsoft .NET or Perl, and example SOAP messages. This kit is downloadable for free, and Google doesn't charge any fees to obtain a license key and use the Google Webs API for noncommercial use. Your license key entitles your application to make 1,000 automated Google search queries per day. If you're developing an application for commercial resale, you must first obtain written consent from Google.

Commentary: Web 2.0

By making its APIs public, Google is facilitating a ton of third-party development. All of this development essentially customizes existing Google information and services for specific purposesby filtering search results, hiding Google access behind a different interface, or overlaying proprietary information on top of a Google map. In essence, an application built using a Google API isn't a freestanding application; it's a cooperative venture with Google, merging Google's public data with the application's interface or operation.

These Google-enabled applications are as good an example as any of what some people are calling Web 2.0. What is Web 2.0? Here's how tech pundit (and fellow publisher) Tim O'Reilly defined it:

"Web 2.0 is the network as platform, spanning all connected devices; Web 2.0 applications are those that make the most of the intrinsic advantages of that platform: delivering software as a continually-updated service that gets better the more people use it, consuming and remixing data from multiple sources, including individual users, while providing their own data and services in a form that allows remixing by others, creating network effects through an 'architecture of participation,' and going beyond the page metaphor of Web 1.0 to deliver rich user experiences."

That's a lot of technospeak, but I think Tim's onto something. In essence, Web 2.0 is a more collaborative web, where applications are virtual (not solely housed on a single computer or website); where data is freely shared between applications, users, and websites; and where operating systems are irrelevant and the Web itself becomes the platform.

In this aspect, Google-based applications and mashups demonstrate a first step toward Web 2.0. The applications built around the Google APIs aren't solely housed on a single computer or website; they require access to and coordination with Google's servers and databases. The data served by one of these applications isn't solely the developer's data; it's either mostly or partly Google's data, as shaped for the developer's needs. And these applications aren't Windows- or Mac-based apps; they're OS-independent, truly using the Web (or, more accurately, the Google API) as the platform.

When you encounter a Google map mashup or a custom Google search application, you're experiencing a little bit of the Web 2.0 future. In this Web 2.0 world, application developers depend on Google (and other companies that offer open access to their APIs and data) to complete their programs; users get as much value from Google's data as they do from the application itself. It's a cooperative effort, one in which the end user benefits tremendously.



Previous Page
Next Page