Chapter 14. Designing an API

This chapter covers

  • Creating JSON responses using ActiveModel::Serializers
  • Creating an API namespace
  • Request testing and using HTTParty for manually interacting with your API
  • Responding appropriately to common API errors

It’s becoming more and more apparent that if you have an application of any significance, you’re going to need an application programming interface, or API. Some applications are only an API. ProgrammableWeb (www.programmableweb.com/), a blog that keeps track of the API space, has a directory of APIs, and at the time of writing, there are 13,628 being tracked. By the time you read this, there could be over 15,000 listed. That’s a lot of APIs!

In this chapter, we’ll compare a few different ...

Get Rails 4 in Action 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.