JsonAPI
Standardize your API responses with JSON:API for better productivity and caching
About JsonAPI
JSON:API is a specification for building APIs in JSON that promotes consistency, reduces development friction, and enables efficient client-side caching. By adopting shared conventions, teams can focus on application logic while leveraging standardized tooling and best practices. The specification supports creating, reading, updating, and deleting resources, and includes features like pagination, relationships, and included resources to streamline data fetching.
FAQ
JSON:API version 1.0 is stable and follows a never remove, only add strategy, ensuring backward compatibility. The version helps track additive changes to the specification and indicates which features a particular implementation may support.
JSON:API flattens the entire graph of objects at the top level, ensuring a single representation of each document in the payload. It uses IDs for linkage, enabling caching and reducing HTTP requests. HAL is a serialization format only, while JSON:API formalizes client-server interfaces with caching and update mechanisms.
The server can include an Allow header in its response to indicate the methods the requested resource supports. For example, a HEAD request to /articles might return Allow: GET,POST, showing that the client can GET the collection and POST to create new resources.
PUT is designed to completely replace a resource's state, while PATCH is intended for partial updates. JSON:API uses PATCH for partial updates and full resource replacement, as it aligns with HTTP specifications and is widely supported by clients.
Yes, you can find the JSON Schema definition for JSON:API at http://jsonapi.org/schema. This schema is restrictive but flexible enough to be extended within your documentation.
Arrays are naturally ordered, allowing for more natural sorting by default or specified criteria, whereas sets require metadata to specify order among members.
Primary resources are isolated because their order and number are often significant. Nesting related resources in an included object prevents conflicts when a primary resource has related resources of the same type.
No, JSON:API has no requirements about URI structure. Implementations are free to use whatever form they wish for URIs and custom endpoints.
Alternatives to consider
Community ratings & full listCategories
Claim this tool
Are you the founder? Claim your profile to update details and track views.
Claim tool