What Is REST?

The Technorati API

Feel free to search the blogosphere all you want using the Technorati Web page. However, as a Web application developer, you might want to automate that search or enable your Web page visitors to view information retrieved from the blogosphere based on their own search criteria.

To make that happen, use the Technorati API. Like many APIs on the Internet, the Technorati API uses REST.

What Is REST?

REST is an acronym for Representational State Transfer. The full explanation of everything entailed in a proper REST definition is outside of the scope of this article; however, it is available elsewhere on IBM developerWorks (see the links provided in Resources). For the subject covered here, it is sufficient to state that REST enables developers to access information and resources using a simple HTTP invocation.

Think of REST this way: To obtain domain-specific data, you simply point a URL to a specific location. For the purposes of this article, that’s really all it is. You can also think of it as a simplified Web service, but if you say that too loudly around the wrong people, you might find yourself in the middle of a debate.

In reference to the subject at hand, the Technorati API is a REST service that enables users to point to a specific URL and retrieve a variety of articles from the blogosphere that meet the criteria specified in the URL. This enables you, as a developer, to accept input within a Web application and dynamically query the blogosphere based on that input using a simple URL that encodes the input into a format the API understands.

Getting started: A simple example

Consider the example in Listing 1:
Listing 1. A simple search


This is a fairly simple URL with only two request parameters.

Note that the actual Technorati API function is the word that follows the final slash (search). This indicates, unsurprisingly, that this REST invocation will perform a search against the blogosphere.

The first parameter is the key. The actual key used varies from user to user and is not really the xxxx character string. To obtain the key that you will use, you need to register with Technorati and request a key. Fortunately this is easy and free. Unfortunately, this means that you cannot simply copy and paste the URLs from this article into a browser and see the results. You have to substitute your own key for this xxxx string.

The second request parameter is the actual query. Just like in the manual example, the search uses the keyword Obama.

After you substitute your own key for the xxxx string, you can then plug that URL into a Web browser and see what results are returned. Your results will vary depending on your Web browser brand and version. Whatever the results on the screen, it’s best to right click on the page and select View Source to view the actual XML that is returned.

While the actual contents will also vary based on when your query is executed, the results should resemble Listing 2.
Listing 2. Output from a simple search (partial output)

<?xml version="1.0" encoding="utf-8"?>
<!-- generator="Technorati API version 1.0 /search" -->
<!DOCTYPE tapi PUBLIC "-//Technorati, Inc.//DTD TAPI 0.02//EN"
<tapi version="1.0">
      <name>Critica Pura</name>
      <lastupdate>2009-06-21 17:13:23 GMT</lastupdate>
   <title>Jib Jab Obama</title>
   <excerpt>Try JibJab Sendables</excerpt>
   <created>2009-06-21 17:13:23 GMT</created>

Interestingly enough, the first query result as of this writing is a foreign language blog entry (at least, foreign to those who speak English).

The result element provides metadata information about the query results. The query child provides the actual query keyword. The querycount child provides the number of articles from the blogosphere that matched the query.

Many item elements follow the result element. Each item element corresponds to a blog article that matched the search criteria.

The weblog element provides information about the blog itself. This is information about the entire blog as opposed to just the article that matched the criteria. Table 1 describes the weblog child elements.
Table 1. weblog child elements

Element Description
name Actual name of the blog itself
url URL of the blog
rssurl URL of the Really Simple Syndication (RSS) feed for that blog
atomurl URL of the Atom feed for that blog
inboundblogs Number of blogs that link to that blog
inboundlinks Number of external sites that link back to that blog
lastupdate Date and time the blog was last updated

The elements described in Table 2 are children of item as opposed to weblog. These children refer to the article itself.
Table 2. item child elements

Element Description
title Actual title of the blog article
excerpt Synopsis of the blog article
created Date and time the article was written
permalink URL for the blog article

Add to Technorati Add to Del.icio.us Add to Furl Add to Yahoo My Web 2.0 Add to Reddit Add to Digg Add to Spurl Add to Wists Add to Simpy Add to Newsvine Add to Blinklist Add to Fark Add to Blogmarks Add to GoldenFeed

  1. When some one searches for his essential thing, so he/she wants to
    be available that in detail, therefore that thing is maintained over here.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: