Perform Batch Actions

You can combine multiple operations into a single HTTP request (batch actions) to improve performance. The request body is a JSON object with a field named parts, which is an array of objects. Each object in the array contains:
  • A unique ID

  • A relative path to the resource

  • An operation

  • (Optional) A payload

The JSON schema of a batch action request is as follows:


{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "title": "Batch execution",
    "description": "Group multiple requests together ('part').",
    "definitions": {
        "Part": {
            "type": "object",
            "allOf": [
                {
                    "properties": {
                        "id": {
                            "type": "string",
                            "description": "An identification provided by the client to distinguish each part provided in the batch request."
                        },
                        "path": {
                            "type": "string",
                            "description": "Resource's location."
                        },
                        "operation": {
                            "type": "string",
                            "enum": [
                                "get",
                                "create",
                                "update",
                                "replace",
                                "delete"
                            ],
                            "description": "The operation that will be performed."
                        },
                        "preconditionSucceeded": {
                            "type": "boolean",
                            "description": "This attribute is set in the batch response only when ifMatch or ifNoneMatch are provided in the request. It will be 'true' if the precondition (ifMatch/ifNoneMatch) was satisfied, otherwise 'false'."
                        },
                        "payload": {
                            "oneOf": [
                                {
                                    "$ref": "resource-item.json",
                                    "description": "The payload that will be used in the operation. Example: a resource instance should be provided in order to execute a 'create'."
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        }
                    },
                    "required": [
                        "id",
                        "path",
                        "operation"
                    ]
                }
            ],
            "anyOf": [
                {
                    "properties": {
                        "ifMatch": {
                            "type": "string",
                            "description": "This attribute is analogous to the If-Match header. It represents a precondition to execute this operation. The value can be null (same effect of 'If-Match: *') or an array of resource versions."
                        }
                    }
                },
                {
                    "properties": {
                        "ifNoneMatch": {
                            "type": "string",
                            "description": "This attribute is analogous to the If-None-Match header. It represents a precondition to execute this operation. The value can be null (same effect of 'If-None-Match: *') or an array of resource versions."
                        }
                    }
                }
            ],
            "description": "Represents a request."
        }
    },
    "properties": {
        "parts": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/Part"
            },
            "description": "Array that represents multiple requests."
        }
    },
    "required": [
        "parts"
    ]
}