JSON:API conventions
Every request and response follows JSON:API v1.1.
Content type
Content-Type: application/vnd.api+json Accept: application/vnd.api+json
Resource document
{
"data": {
"id": "3",
"type": "accounts",
"attributes": {
"name": "Luis",
"email": "luislopes@ilove.me"
},
"relationships": {
"businesses": { "data": [{ "id": "900001", "type": "businesses" }] }
}
}
}
Collections
{
"data": [ { "id": "901162", "type": "professionals", "attributes": { ... } } ],
"meta": { "total": 47, "page": 1, "per-page": 25 }
}
Creating & updating
POST /professionals
Content-Type: application/vnd.api+json
{
"data": {
"type": "professionals",
"attributes": {
"name": "Maria",
"email": "maria@example.com"
}
}
}
Errors
{
"errors": [
{
"status": "422",
"title": "Validation failed",
"detail": "must be present",
"source": { "pointer": "/data/attributes/tax-number" }
}
]
}
Field naming & query parameters
- All attribute names are kebab-case (
created-at,tax-number) idis always a string, even when numeric?include=businesses— sideload related resources?fields[professionals]=name,email— sparse fieldsets?filter[status]=active— server-defined filtering?sort=-created-at— prefix with-for descending?page[number]=2&page[size]=25— pagination