From the http://jsonapi.org site:
If you’ve ever argued with your team about the way your JSON responses should be formatted, JSON API can be your anti-bikeshedding tool.
By following shared conventions, you can increase productivity, take advantage of generalized tooling, and focus on what matters: your application.
Clients built around JSON API are able to take advantage of its features around efficiently caching responses, sometimes eliminating network requests entirely.
Here’s an example response from a blog that implements JSON API:
{
"links": {
"self": "http://example.com/articles",
"next": "http://example.com/articles?page[offset]=2",
"last": "http://example.com/articles?page[offset]=10"
},
"data": [{
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON API paints my bikeshed!"
},
"relationships": {
"author": {
"links": {
"self": "http://example.com/articles/1/relationships/author",
"related": "http://example.com/articles/1/author"
},
"data": { "type": "people", "id": "9" }
},
"comments": {
"links": {
"self": "http://example.com/articles/1/relationships/comments",
"related": "http://example.com/articles/1/comments"
},
"data": [
{ "type": "comments", "id": "5" },
{ "type": "comments", "id": "12" }
]
}
},
"links": {
"self": "http://example.com/articles/1"
}
}],
"included": [{
"type": "people",
"id": "9",
"attributes": {
"first-name": "Dan",
"last-name": "Gebhardt",
"twitter": "dgeb"
},
"links": {
"self": "http://example.com/people/9"
}
}, {
"type": "comments",
"id": "5",
"attributes": {
"body": "First!"
},
"relationships": {
"author": {
"data": { "type": "people", "id": "2" }
}
},
"links": {
"self": "http://example.com/comments/5"
}
}]
}
The response above contains the first in a collection of “posts”, as well as links to subsequent members in that collection. It also contains resources linked to the post, including its author and comments. Last but not least, links are provided that can be used to fetch or update any of these resources.
JSON API covers creating and updating resources as well, not just responses.
Implementation status
- #2731339: [META] Provide full compliance for GET requests is tracking progress of the GET operation support.
- #2734395: [META] Provide full support for write operations is tracking progress write operations support.
- #2736693: [META] Implement the bulk extension is tracking progress of the bulk operations extension.
This YouTube playlist contains a series of short videos covering the implementation status of the module: https://www.youtube.com/playlist?list=PLZOQ_ZMpYrZsyO-3IstImK1okrpfAjuMZ
Compatibility
This module is compatible with Drupal core 8.2.x and higher. There are known issues for 8.1.x that are not planned to be addressed.
Project Information
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: Third-party Integration
- Reported installs: 88 sites currently report using this module. View usage statistics.
- Downloads: 1,017
- Automated tests: Enabled
- Last modified: October 19, 2016
Stable releases are covered by the security advisory policy.
Look for the shield icon below.
Downloads
Recommended releases
| Version | Download | Date |
|---|---|---|
| 8.x-1.0-alpha3 | tar.gz (70.52 KB) | zip (137.66 KB) | 2016-Nov-23 |
