Building a JSON API with Rails — Part 6: The JSON API Spec, Pagination, and Versioning
Building a JSON API is a continual learning process that you improve upon every time you do it. In your first go around, you’ll probably understand how to render and format your JSON from a server versus just returning server-built HTML. After that, you may learn fun things such as handling authentication. As you get more seasoned, you’ll learn to fine-tune your API and employ some best practices right from the get-go. That’s what I want to help you with; my most recent blog post (a continuation of my Rails API series) reviews some best practices as you’re building out a JSON API with Rails. It covers the JSON API spec, pagination, versioning and more. The post reviews how to do this using Rails 5 — but the concepts are completely language agnostic, so even if you don’t use Rails, you can still definitely learn from it.