In this section, we will update the chatrum application to enable some interaction with Twitter. What we're going to do is search for tweets based on a hashtag and a username. For that, we'll look for items in the chatrum that have special patterns, that is, words starting with a hash (#) or an at sign (@). First of all, we'll see how to use Twitter to retrieve information using a browser and the API specification.
The Twitter REST API provides an entry point from which it will be able to do a lot of search operations. This entry point is the URL http://search.twitter.com/search.json. At first glance we can guess that the operations will represent the response in JSON.
In order to search on a hashtag, this URL can be set with a search parameter named q
that holds the hashtag, prefixed by the well-known # character. Of course, the request is a GET one.
So let's try this in our browser; it will help us later because we'll have the opportunity to analyze the output and...