Batching

The batch endpoint can be used to make multiple request to our api in a single call

POST /api/batch
1

Request body

ParameterTypeRequiredLimitations
requestsarrayrequiredArray of objects containing required method and path properties and optional body
requests.*.methodstringrequiredThe method type of the intended request: GET, POST, PUT, DELETE, PATCH
requests.*.pathstringrequiredThe relative path of api endpoint. Must start with api/
requests.*.bodyarrayoptionalArray of properties for the body of the request

Restrictions

A maximum of 50 requests can be performed in a single batch
The order of response objects is the same as the order in which they were sent

Response

Response Code: 200 OK
1
{
  "total": 1,
  "successful": 1,
  "failed": 0,
  "responses": [
    {
      "code": 200,
      "body": {
        "data": [
          {
            "id": "1",
            "name": "test field",
            "key": "test_field",
            "type": "text"
          },
          {
            "id": "2",
            "name": "new field",
            "key": "new_field",
            "type": "text"
          }
        ]
      }
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

Error

If invalid data has been passed

Response Code: 422 Unprocessable Entity
1
{
  "message": "The given data was invalid.",
  "errors": {
    "requests.0.method": ["The requests.1.method field is required."],
    "requests.0.path": ["The requests.0.path field is required."]
  }
}
1
2
3
4
5
6
7

If one of the batched requests has failed the whole batch will still be processed and the payload for the relevant errored batch will return the error

{
  "total": 1,
  "successful": 0,
  "failed": 1,
  "responses": [
    {
      "code": 422,
      "body": {
        "message": "The given data was invalid.",
        "errors": {
          "requests.0.method": ["The name field is required."]
        }
      }
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Last Updated: