Format: JSON API 1.0
This is a structure of all objects in a JSON API response body. This document will be used to build a JSON API Client in PHP. Please leave me a comment if there is something wrong or missing.
Note: This document covers only a possible JSON API response body. A request body can have some exceptions.
Symbol | Description |
---|---|
1 | at least one of these properties is required |
* | zero, one or more properties |
+ | required |
- | optional |
! | not allowed |
- Document object
- Resource Identifier object
- Resource object
- Attributes object
- Relationship Collection object
- Relationship object
- Error object
- Error Source object
- Link object
- Document Link object
- Relationship Link object
- Error Link object
- Pagination Link object
- Jsonapi object
- Meta object
- extends:
- extended by:
- property of:
| Name | Value | Note
--- | ---- | ----- | ----
1 | data | - null
- Resource Identifier object
- Resource object
- array()
- array(Resource Identifier object)
- array(Resource object) | not allowed, if 'errors' exists
1 | errors | array(Error object) | not allowed, if 'data' exists
1 | meta | Meta object |
- | jsonapi | Jsonapi object |
- | links | Document Link object |
- | included | array(Resource object) | not allowed, if 'data' doesn't exist
- extends:
- extended by: Resource object
- property of:
| Name | Value | Note
--- | ---- | ----- | ----
- | type |
string
| - | id |
string
|
- | meta | Meta object |
- extends: Resource Identifier object
- extended by:
- property of: Document object
| Name | Value | Note
--- | ---- | ----- | ----
- | attributes | Attributes object |
- | relationships | Relationship Collection object |
- | links | Link object |
- extends: Meta object
- extended by:
- property of: Resource object
| Name | Value | Note
--- | ---- | ----- | ----
- |
string
| mixed | ! | type | | already used in Resource object | ! | id | | already used in Resource object | ! | relationships | | reserved by spec for future use | ! | links | | reserved by spec for future use |
- extends:
- extended by:
- property of: Resource object
| Name | Value | Note
--- | ---- | ----- | ----
- |
string
| Relationship object | not allowed, if already used in parents Attributes object property) ! | type | | already used in Resource object ! | id | | already used in Resource object
- extends:
- extended by:
- property of: Relationship Collection object
| Name | Value | Note
--- | ---- | ----- | ----
1 | links | Relationship Link object |
1 | data | - null
- Resource Identifier object
- array()
- array(Resource Identifier object) |
1 | meta | Meta object |
- extends:
- extended by:
- property of: Document object
| Name | Value | Note
--- | ---- | ----- | ----
- | id |
string
| - | links | Error Link object |
- | status |
string
| - | code |
string
| - | title |
string
| - | detail |
string
| - | source | Error Source object |
- | meta | Meta object |
- extends:
- extended by:
- property of: Error object
| Name | Value | Note
--- | ---- | ----- | ----
- | pointer |
string
| - | parameter |
string
|
- extends:
- extended by:
- property of:
| Name | Value | Note
--- | ---- | ----- | ----
- |
string
| -string
- Link object |
- | href |
string
| - | meta | Meta object |
- extends: Link object
- extended by:
- property of: Document object
| Name | Value | Note
--- | ---- | ----- | ----
- | self |
string
| - | related |
string
| - | pagination | Pagination Link object |
- extends: Link object
- extended by:
- property of: Relationship object
| Name | Value | Note
--- | ---- | ----- | ----
1 | self | string
|
1 | related | string
|
- | pagination | Pagination Link object | Only exists if the parent relationship object represents a to-many relationship
- extends: Link object
- extended by:
- property of: Error object
| Name | Value | Note
--- | ---- | ----- | ----
- | about | -
string
- Link object |
- extends: Link object
- extended by:
- property of:
| Name | Value | Note
--- | ---- | ----- | ----
- | first | -
null
-string
| - | last | -
null
-string
| - | prev | -
null
-string
| - | next | -
null
-string
|
- extends:
- extended by:
- property of: Document object
| Name | Value | Note
--- | ---- | ----- | ----
- | version |
string
| Default:"1.0"
- | meta | Meta object |
- extends:
- extended by: Attributes object
- property of:
| Name | Value | Note
--- | ---- | ----- | ----
- |
string
|mixed
|