Read more

JSON APIs: Default design for common features

Niklas Hä.
September 07, 2022Software engineer at makandra GmbH

When you build a JSON API you need to come up with a style to represent attributes, pagination, errors or including associated objects. Instead of reinventing the wheel, you may reuse successful API designs.

JSON API

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

JSON:API Show archive.org snapshot specifies common features found in most JSON APIs, like pagination, ordering and nested resources. The spec looks very similar to how one would build an API with Rails and uses similar patterns. Even if you don't plan on supporting the whole spec, it can still make sense to know how the spec would solve a problem.

Following a certain set of rules for you API can make it easier for your clients to consume it. Clients can use client libraries Show archive.org snapshot to access your API and can read up on the JSON:API spec to get a basic understanding on how to use your API.

Stripe API

If you don't like the conventions of JSON-API, consider the style of an existing JSON API that you enjoy working with. For instance the Stripe API Show archive.org snapshot is a good source of inspiration.

General advice

Posted by Niklas Hä. to makandra dev (2022-09-07 09:55)