You can specify multiple operations to apply to various objects of various types.
Relative URL
HTTP Request Method
/api/v4/backend-deployment-id/batch.json
POST
Batch Operation Limit
Up to 1000 operations are supported per payload. If more than 1000 operations are included in a payload the request will be considered invalid and result in an error.
Parameters
An array of operations is supplied in a hash under the key operations. These operations are applied in the order they appear in the array. Each operation consists of a hash with required fields: method, containing an appropriate keyword, and object containing a hash with, at least, the two required fields - type and id. If the optional key stop_on_error: true is supplied alongside operations, any operations following an error will not be applied.
Operation
Parameters
Create an object
"method": "post""object" : Hash with fields:
"type" : (required) The name of the model.
"id" : (optional) The object ID. If omitted, one will be generated. If provided and the ID already exists, the operation will fail.
All the fields that represent the entire object
Replace an object
"method": "put""object" : Hash with fields:
"type" : (required) The name of the model.
"id": (required) The object ID
All the fields that represent the entire object
Partial update on an object
"method": "patch""object" : Hash with fields:
"type" : (required) The name of the model.
"id" : (required) The object ID
Only the fields to be updated on the object
Delete an object
"method": "delete""object" : Hash with fields:
"type" : (required) The name of the model.
"id" : (required) The object ID
Response
An ill-formed or illegal request will fail without performing any of the operations. A well-formed request should execute each operation in order, and return a success response. The body of the response should contain the requested method, object model and object id, as well as a "success" flag and any relevant "error" details for each operation. See Error Responses for a description of each error.
{"stop_on_error":false,"operations": [ {"method":"put","object": {"type":"asset","id":"eacb4836-f1b9-11e1-9750-001cc01904e3" },"success":true }, {"method":"patch","object": {"type":"asset","id":"44218dfe-7c3f-11e2-95e1-0026189d9dc0" },"success":false,"error": {"type":"INVALID_VALUE","title":"Invalid value specified.","detail":"Invalid option \"adsghjsd\" for field 'make'.","see":"https://docs.journeyapps.com/reference/backend-api/api-reference/error-responses#INVALID_VALUE" } }, {"method":"delete","object": {"type":"asset","id":"efa3886d-d9a6-4383-a2c0-c7e28a6c21d0" },"success":false,"error": {"type":"OBJECT_NOT_FOUND","title":"Object not found.","detail":"No aseset found with ID: 'efa3886d-d9a6-4383-a2c0-c7e28a6c21d0'","see":"https://docs.journeyapps.com/reference/backend-api/api-reference/error-responses#OBJECT_NOT_FOUND" } } ]}
{"stop_on_error":true,"operations": [ {"method":"put","object": {"type":"asset","id":"eacb4836-f1b9-11e1-9750-001cc01904e3" },"success":true }, {"method":"patch","object": {"type":"asset","id":"44218dfe-7c3f-11e2-95e1-0026189d9dc0","make":"adsghjsd" },"success":false,"error": {"type":"INVALID_VALUE","title":"Invalid value specified.","detail":"Invalid option \"adsghjsd\" for field 'make'.","see":"https://docs.journeyapps.com/reference/backend-api/api-reference/error-responses#INVALID_VALUE" } }, {"method":"delete","object": {"type":"asset","id":"efa3886d-d9a6-4383-a2c0-c7e28a6c21d0" },"success":false,"error": {"type":"BATCH_ABORTED","title":"Batch processing aborted due to error.","detail":"Skipping this operation because a previous operation in this batch failed.","see":"https://docs.journeyapps.com/reference/backend-api/api-reference/error-responses#BATCH_ABORTED" } } ]}