Chapter 5. Introducing the Twitter API

In This Chapter

  • Defining an API

  • Interacting with Twitter's API

API stands for Application Programming Interface. It's kind of like a user interface, except instead of delivering content that humans can read and use, an API delivers content that software can read and use. For example, a Web site can deliver beautiful graphics that are thoughtfully laid out, with large readable fonts, so that the user can easily find and read the information he or she is looking for. This type of human-oriented design is difficult for a program to read because it relies on context. A program can access the same Web site using an API. The API returns an XML or JSON data file that can then be parsed and processed easily.

An API does more than allow your program to easily read data. It also allows you to perform actions on the remote system. With the Twitter API, by simply requesting a URL with a few HTTP POST parameters, you can post a tweet or send a direct message.

Twitter's API is designed to be RESTful. REST (Representational State Transfer) is a software design pattern for creating APIs. In a nutshell, it means the API is designed to leverage HTTP requests, such as GET, POST, DELETE, and PUT. And it means that requesting data from the API is as straightforward as requesting a Web page.

Play Nice and Follow the Terms of Service

When developing your Twitter application, keep in mind that you're eating at Twitter's dinner table and you're their guest. Be respectful, ...

Get Twitter® Application Development for Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.