Understanding Google’s APIs

As noted, API is a synonym for Application Programming Interface. As the name implies, this is an interface used in the programming of applications. More precisely, a Google API is an interface between the application you develop and a specific Google service.

Note

To use any of Google’s APIs, you must first register on the Google Code site (code.google.com). When you create your Google API account, Google issues you a personal license key; this license key must be integrated into your code so that every time your application queries a Google database, the license key is part of the query string.

For example, the Google Custom Search API lets you tie into Google’s main search index. That lets you add web search capability to a software program, web-based application, or dynamic website. You develop the content around the search engine, and then use the Custom Search API to let your users query the Google search index.

By making its APIs publicly available, Google becomes a major web services provider. All the services that Google offers can now be incorporated in the applications you write; you provide the interface and subtext, while Google serves the “live” data.

To use a Google API, you have to remotely connect to the API within your program code. All such communications are executed via the Simple Object Access Protocol (SOAP), which is an XML-based technology used for web services.

Types of Google-Based Applications

You can use Google’s various APIs to add all sorts of functionality to your applications. You can enable a 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 an application access historical data in the Google cache. You can even use the Google Gears API to transform your web-based applications so that they work when your users aren’t connected to the Internet. The bottom line is, Google’s developer tools let you do anything you can do from the Google website from within your applications.

What types of applications can you write using Google’s developer tools? Here are just a few ideas:

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

  • Data analysis. Create 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. Create a program that retrieves and analyzes the amount of information available on a subject over time.

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

  • Map mashup. Add a customized map or driving directions to your website or application.

  • Event calendar. Add a calendar of upcoming events to a website or application.

  • Video player. Play selected YouTube videos in your application or on your website.

  • Spell checking. Incorporate Google’s spell-checking function into any application.

That’s just the tip of the iceberg, of course. Recognizing the vast amounts of data that Google puts at your fingertips, how you incorporate that information into your applications is up to you.

Note

Obviously, this chapter can only cover the bare basics of Google application programming. To learn more, check out the book Google Web Toolkit Applications (Ryan Dewsbury, Addison-Wesley Professional, 2007), available at a bookstore near you.

Developing Your Own Google-Based Applications

If you’re a software developer or web designer, here’s a URL you need to know: code.google.com. This is the address of Google Code, the home base for all of Google’s developer services.

As you can see in Figure 43.1, the Google Code home page links to all the developer resources that Google makes available for its various services. It’s also home to the Google Code Blog, which keeps you up to date on all of Google’s developer developments.

Figure 43.1. Google Code—the home page for third-party Google developers.

Google Code—the home page for third-party Google developers.

And just what tools are available? There’s a ton; click the APIs & Developer Tools link, and you see the list detailed in Table 43.1.

Table 43.1 Google Developer Tools

Image Image Image Image

If you’re developing any application that involves web search or other services that Google offers, you should make Google Code your starting point. From here, you can download all the APIs, tools, and documentation you need to incorporate Google technology into the applications you develop.

Developing with the Google App Engine

The quick way to start developing applications using Google’s APIs is to utilize the Google App Engine (code.google.com/appengine). The App Engine lets you create and run your web-based applications using Google’s infrastructure. You don’t have to acquire or maintain your own web servers; applications housed on Google App Engine use Google’s servers, instead.

The advantages of using Google to host your applications are many. Most notable is the fact that you don’t have to scale your hardware as you get more users and your storage and bandwidth needs grow. You just upload your application to the Google App Engine servers, and Google does all the rest; as your user numbers increase, Google automatically assigns the necessary bandwidth and storage space.

Note

The Google App Engine is an example of cloud computing, where applications and data are housed in a web-based server “cloud” and accessible to any authorized user with an Internet connection. Learn more about cloud computing in my related book, Cloud Computing: Web-Based Applications That Change the Way You Work and Collaborate Online (Michael Miller, Que, 2008).

The App Engine is more than just an application-hosting service, however; it’s a fully integrated application environment. In addition to the dynamic web hosting, you get a development environment based on the App Engine software development kit (SDK). The SDK includes a web server application that lets you simulate the App Engine environment on your local computer, so you can develop offline as well as online. It runs on any computer using the Python 2.5 programming language; versions are available for Windows, Mac OS X, and Linux.

Tip

If you’re still not sure how to integrate Google APIs into your own applications, check out the applications featured in the Google Applications Gallery (appgallery.appspot.com). These are all applications developed within and hosted by the Google App Engine; there’s a lot of exciting stuff here!

And here’s the best thing, especially for developers on a budget: Google App Engine is completely free. That’s right, after you sign up and download the SDK, you can develop and publish your application at no charge. At present, Google provides 500MB of persistent storage and enough bandwidth for approximately 5 million page views a month. (Of course, if you need more space or bandwidth, Google will be glad to sell it to you.)

Commentary

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.162.204