Open
Description
It has been widely requested that JSON-API support creating/editing/updating/deleting multiple records in a single request (#202, #205, #753, #536). We have attempted to paint this bikeshed repeatedly over the years. Providing an "official" solution, or solutions, to this problem is one of the primary goals for v1.1 of this specification.
There are several requirements for a solution:
- It should allow mixed actions in a single request (e.g. creating + updating).
- It should work for multiple types of resources (e.g. articles + tags) that would otherwise be accessed at different endpoints.
- Every request should be transactional (i.e. all operations should succeed or fail together).
- Additive to the base spec (probably as an extension).
Here are a couple use-cases that test these requirements:
- Create two articles, add one existing tag to both, create a new tag and add to both.
- Change the title of an article and update its tags: add one existing tag, create another, and remove another (without replacing the whole tag set).
We would like the community to propose ideas for how to solve these use cases (or chime in to support solutions provided in the responses to follow).
Assume the following data is present
GET /articles
{
"data": [{
"id": "article-1",
"type": "articles",
"attributes": {
"title": "the first article",
"content": "some content for an article",
},
"relationships": {
"tags": {
"data": [
{ "id": "tag-1", "type": "tags" }
]
}
}
}]
}
GET /tags
{
"data": [{
"id": "tag-1",
"type": "tags"
"attributes": {
"name": "one"
}
}, {
"id": "tag-2",
"type": "tags"
"attributes": {
"name": "two"
}
}]
}
Metadata
Metadata
Assignees
Labels
No labels