Zum Inhalt springen
uencoder

JSON:API-Spezifikation

Referenz für der JSON:API specification für consistent REST API responses mit relationships und links.

Document Structure

JSON:API documents have a top-level data, errors, or meta member. Resource objects contain id, type, attributes, and relationships. Relationships link to other resources by id and type, avoiding embedded data by default. Links provide URLs for pagination and related resources. The included section sideloads related resources to avoid N+1 requests. The format standardizes error objects with status, code, title, and detail.

resource object
id, type, attributes
standardized shape
relationships
Links to other resources
by id + type
included
Sideloaded resources
avoid N+1

Conventions

Relationships can be to-one or to-many, with links for fetching or manipulating. Sparse fieldsets allow requesting only specific fields via query params. Sorting, filtering, and pagination use standardized query parameters. PATCH updates use JSON Patch-like merge semantics. The specification reduces API design decisions and client complexity. Content type must be application/vnd.api+json.

sparse fieldsets
Request specific fields
fields[type]=field1,field2
pagination
Standardized query params
page[number], page[size]
content type
application/vnd.api+json
media type required

Verwandte Tools

参考链接