Rails APIs

Why Use Rails for JSON APIs?

From the Rails Guides: (opens new window)

The first question a lot of people have when thinking about building a JSON API using Rails is: "isn't using Rails to spit out some JSON overkill? Shouldn't I just use something like Sinatra?". [Or Express.js?]

For very simple APIs, this may be true. However, even in very HTML-heavy applications, most of an application's logic lives outside of the view layer.

The reason most people use Rails is that it provides a set of defaults that allows developers to get up and running quickly, without having to make a lot of trivial decisions.

Tools

  • apiup (opens new window) - Rails project template to create an API pre-configured for JSON:API and OAuth 2 authentication

Sample APIs

Resources

Rails Guides

The following pages in the Guides are relevant to API development:

Gems

Deployment

API Documentation