{"action":"created","issue":{"url":"https://api.github.com/repos/json-api/json-api/issues/795","repository_url":"https://api.github.com/repos/json-api/json-api","labels_url":"https://api.github.com/repos/json-api/json-api/issues/795/labels{/name}","comments_url":"https://api.github.com/repos/json-api/json-api/issues/795/comments","events_url":"https://api.github.com/repos/json-api/json-api/issues/795/events","html_url":"https://github.com/json-api/json-api/issues/795","id":91770622,"number":795,"title":"Support for multiple operations in a single request","user":{"login":"tkellen","id":1004324,"avatar_url":"https://avatars0.githubusercontent.com/u/1004324?v=3","gravatar_id":"","url":"https://api.github.com/users/tkellen","html_url":"https://github.com/tkellen","followers_url":"https://api.github.com/users/tkellen/followers","following_url":"https://api.github.com/users/tkellen/following{/other_user}","gists_url":"https://api.github.com/users/tkellen/gists{/gist_id}","starred_url":"https://api.github.com/users/tkellen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkellen/subscriptions","organizations_url":"https://api.github.com/users/tkellen/orgs","repos_url":"https://api.github.com/users/tkellen/repos","events_url":"https://api.github.com/users/tkellen/events{/privacy}","received_events_url":"https://api.github.com/users/tkellen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/json-api/json-api/milestones/2","html_url":"https://github.com/json-api/json-api/milestone/2","labels_url":"https://api.github.com/repos/json-api/json-api/milestones/2/labels","id":1196038,"number":2,"title":"JSON-API 1.1-beta","description":"1.1-beta launch.","creator":{"login":"tkellen","id":1004324,"avatar_url":"https://avatars0.githubusercontent.com/u/1004324?v=3","gravatar_id":"","url":"https://api.github.com/users/tkellen","html_url":"https://github.com/tkellen","followers_url":"https://api.github.com/users/tkellen/followers","following_url":"https://api.github.com/users/tkellen/following{/other_user}","gists_url":"https://api.github.com/users/tkellen/gists{/gist_id}","starred_url":"https://api.github.com/users/tkellen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkellen/subscriptions","organizations_url":"https://api.github.com/users/tkellen/orgs","repos_url":"https://api.github.com/users/tkellen/repos","events_url":"https://api.github.com/users/tkellen/events{/privacy}","received_events_url":"https://api.github.com/users/tkellen/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":0,"state":"open","created_at":"2015-07-07T02:28:26Z","updated_at":"2015-12-29T13:33:57Z","due_on":"2015-09-30T07:00:00Z","closed_at":null},"comments":112,"created_at":"2015-06-29T10:47:02Z","updated_at":"2017-05-07T21:25:11Z","closed_at":null,"body":"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.\n\nThere are several requirements for a solution:\n- It should allow mixed actions in a single request (e.g. creating + updating).\n- It should work for multiple types of resources (e.g. articles + tags) that would otherwise be accessed at different endpoints.\n- Every request should be transactional (i.e. all operations should succeed or fail together).\n- Additive to the base spec (probably as an extension).\n\nHere are a couple use-cases that test these requirements:\n- Create two articles, add one existing tag to both, create a new tag and add to both.\n- 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).\n\n**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).**\n\nAssume the following data is present\n\n```\nGET /articles\n\n{\n  \"data\": [{\n    \"id\": \"article-1\",\n    \"type\": \"articles\",\n    \"attributes\": {\n      \"title\": \"the first article\",\n      \"content\": \"some content for an article\",\n    },\n    \"relationships\": {\n      \"tags\": {\n        \"data\": [\n          { \"id\": \"tag-1\", \"type\": \"tags\" }\n        ]\n      }\n    }\n  }]\n}\n```\n\n```\nGET /tags\n\n{\n  \"data\": [{\n    \"id\": \"tag-1\",\n    \"type\": \"tags\"\n    \"attributes\": {\n      \"name\": \"one\"\n    }\n  }, {\n    \"id\": \"tag-2\",\n    \"type\": \"tags\"\n    \"attributes\": {\n      \"name\": \"two\"\n    }\n  }]\n}\n```\n"},"comment":{"url":"https://api.github.com/repos/json-api/json-api/issues/comments/299736064","html_url":"https://github.com/json-api/json-api/issues/795#issuecomment-299736064","issue_url":"https://api.github.com/repos/json-api/json-api/issues/795","id":299736064,"user":{"login":"mockdeep","id":80543,"avatar_url":"https://avatars0.githubusercontent.com/u/80543?v=3","gravatar_id":"","url":"https://api.github.com/users/mockdeep","html_url":"https://github.com/mockdeep","followers_url":"https://api.github.com/users/mockdeep/followers","following_url":"https://api.github.com/users/mockdeep/following{/other_user}","gists_url":"https://api.github.com/users/mockdeep/gists{/gist_id}","starred_url":"https://api.github.com/users/mockdeep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mockdeep/subscriptions","organizations_url":"https://api.github.com/users/mockdeep/orgs","repos_url":"https://api.github.com/users/mockdeep/repos","events_url":"https://api.github.com/users/mockdeep/events{/privacy}","received_events_url":"https://api.github.com/users/mockdeep/received_events","type":"User","site_admin":false},"created_at":"2017-05-07T21:25:11Z","updated_at":"2017-05-07T21:25:11Z","body":"Sorry if some of what I'm saying has already been discussed here, but I wonder if a couple of simple  modifications might help in a number of cases. For example, allowing the `'data'` key to be an array seems like it could solve for a lot of use cases, in particular when you want to create a number of the same type of records. Not sure if it would make sense to allow mixing types in that situation, but in most of what I run into I actually just want to use the same verb on the same types of records, e.g.: marking a bunch of tasks completed.\r\n\r\nI can see a different use case where you want to batch operations from a performance and latency perspective. To me this actually seems like a higher level sort of resource, where you simply post to a generic batch operations endpoint and let the server sort it out. From the client perspective, it might be a `CREATE` request to the `/batch` endpoint where the `'data'` contains a nested array of JSONAPI formatted requests, verbs and all. `'data'` itself could point to an array, or it could be an object with a nested array to allow for additional meta stuff on the request, such as `\"data\": { \"operations\": [one, two], \"atomic\": true, \"strict_order\": true }`. This latter actually doesn't seem like it would require any modification to JSONAPI, aside from maybe documenting it as a recommended approach. It would also allow for a more asynchronous process when the request might take longer to process, where the server responds with a record with a status that represents the set of operations and how far along they are."}}
{"actor":{"display_login":"mockdeep"}}