Chapter 13. Designing an API

 

This chapter covers

  • Building an API using new Rails 3 features
  • Rate-limiting the API
  • Versioning APIs

In the past chapters, you’ve created a great application that allows your users to manage projects and tickets through a web browser. In this chapter, you are going to create a way for your users to manage this content through what’s known as an Application Programming Interface (API). As its name implies, an API is a programming interface (for your application) that returns either JavaScript Object Notation[1] (JSON) or XML[2] data for its requests, which are the two most common formats for modern APIs to return information in. People can then create programs or libraries (referred to as clients) to read and present this data in any way they see fit.

One great example of how an API is used is Twitter. Twitter has had an API for an exceptionally long time now, and people have written Twitter clients for just about every operating system out there using this API. The functionality of the site is effectively the same, but people have come up with interesting ways of displaying and modifying that information, such as the Twitter for Mac clients.

13.1. The projects API

13.2. Beginning the tickets API

13.3. Rate limiting

13.4. Versioning an API

13.5. Summary

sitemap