{"action":"created","issue":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/4353","labels_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/4353/labels{/name}","comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/4353/comments","events_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/4353/events","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/4353","id":108205495,"number":4353,"title":"[Ready to Review] API Bulk Modification","user":{"login":"pattisdr","id":9755598,"avatar_url":"https://avatars.githubusercontent.com/u/9755598?v=3","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-09-24T20:14:44Z","updated_at":"2015-10-13T14:45:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/4353","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/4353","diff_url":"https://github.com/CenterForOpenScience/osf.io/pull/4353.diff","patch_url":"https://github.com/CenterForOpenScience/osf.io/pull/4353.patch"},"body":"# Purpose\r\n\r\nAllows bulk modifications of nodes, contributors, children, and node-links.  You can:\r\n- Create/update/delete multiple nodes /v2/nodes/\r\n- Create/update/delete multiple contributors /v2/nodes/{node_id}/contributors/\r\n- Create multiple children /v2/nodes/{node_id}/children/\r\n- Create/delete multiple node-links /v2/nodes/{node_id}/node_links/\r\n\r\nIssue: https://openscience.atlassian.net/browse/OSF-4234\r\n\r\nComplies with json-api bulk extension: \r\nhttp://jsonapi.org/extensions/bulk/\r\n\r\n**Note:** `application/vnd.api+json; supported-ext=\"bulk\"` is **not** in Content-Type header.  The negotiation mechanism is very likely to change http://discuss.jsonapi.org/t/bulk-extension-how-much-is-expected-to-change-prior-to-v1-1/121\r\n\r\n# Changes\r\n1) To **create** multiple nodes, send POST request to /v2/nodes/ with array of resource objects.  Each object needs a `type` and `attributes` field.\r\n```\r\nPOST /v2/nodes/\r\n        {\r\n            \"data\": [{\r\n                \"type\": \"nodes\",\r\n                \"attributes\": {\r\n                    \"title\": \"New title\", \r\n                    \"category\": \"project\"\r\n                }\r\n            },\r\n                {\r\n                \"type\": \"nodes\",\r\n                \"attributes\": {\r\n                    \"title\": \"Better title\", \r\n                    \"category\": \"project\"\r\n                }\r\n            }]\r\n        }\r\n\r\n```\r\n2) To **update** multiple nodes, sent PUT or PATCH request to /v2/nodes/ with array of resource objects. Each object must have `type` and `id`.\r\n```\r\nPATCH /v2/nodes/\r\n        {\r\n            \"data\": [{\r\n                \"id\": \"fdxfr\",\r\n                \"type\": \"nodes\",\r\n                \"attributes\": {\r\n                    \"title\": \"New title\", \r\n                    \"category\": \"instrumentation\"\r\n                }\r\n            },\r\n                {\r\n                \"id\": \"dsfsa\",\r\n                \"type\": \"nodes\",\r\n                \"attributes\": {\r\n                    \"title\": \"Better title\", \r\n                    \"category\": \"hypothesis\"\r\n                }\r\n            }]\r\n        }\r\n```\r\n3) To **delete** multiple nodes, send DELETE request to /v2/nodes/ with array of resource objects. Each object must have `type` and `id`.\r\n```\r\nDELETE /v2/nodes/\r\n\r\n        {\r\n            \"data\": [{\r\n                \"id\": \"fdxfr\",\r\n                \"type\": \"nodes\",\r\n            },\r\n                {\r\n                \"id\": \"dsfsa\",\r\n                \"type\": \"nodes\",\r\n            }]\r\n        }\r\n```"},"comment":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/comments/147737196","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/4353#issuecomment-147737196","issue_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/4353","id":147737196,"user":{"login":"sloria","id":2379650,"avatar_url":"https://avatars.githubusercontent.com/u/2379650?v=3","gravatar_id":"","url":"https://api.github.com/users/sloria","html_url":"https://github.com/sloria","followers_url":"https://api.github.com/users/sloria/followers","following_url":"https://api.github.com/users/sloria/following{/other_user}","gists_url":"https://api.github.com/users/sloria/gists{/gist_id}","starred_url":"https://api.github.com/users/sloria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sloria/subscriptions","organizations_url":"https://api.github.com/users/sloria/orgs","repos_url":"https://api.github.com/users/sloria/repos","events_url":"https://api.github.com/users/sloria/events{/privacy}","received_events_url":"https://api.github.com/users/sloria/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T14:45:20Z","updated_at":"2015-10-13T14:45:20Z","body":"@pattisdr What if another extension allows for `data` to be an array? What if an amendment to the base spec allows for `data` to be an array? Providing `ext=bulk` makes it crystal-clear to both the client and server how the request data should be handled (i.e. according to the JSON API bulk extension)."}}