Batch multiple API endpoints into one request.
1 min
POST
/v1/batch
Body Parameters
- bodyBatchContextrequired
- operationsBatchOperation[]requiredDescription
- methodobject
- Method
- urlstringDescription
- operationIDstringDescription
- bodyobjectDescription
- parametersobjectDescription
- headersobjectDescription
Responses
200
- BatchResponse
- startedAtstring
- endedAtstring
- errorCountinteger
- responseBatchResponseItem[]
- statusStatus
- requestIDstring
- operationIDstring
- methodMethod1
- urlstring
- bodyobject
- startedAtstring
- endedAtstring
400
422
curl
curl --request POST \
--url /v1/batch \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"operations": [
{
"method": {}
}
]
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"operations": [
{
"method": {}
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("/v1/batch", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("/v1/batch")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"operations": [
{
"method": {}
}
]
})
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "/v1/batch"
payload = json.dumps({
"operations": [
{
"method": {}
}
]
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// responses for each endpoint called in the batch request
{
"startedAt": "",
"endedAt": "",
"errorCount": 0,
"response": [
{
"status": 0,
"requestID": "",
"operationID": "",
"method": "",
"url": "",
"body": {},
"startedAt": "",
"endedAt": ""
}
]
}400
// Bad request, invalid parameters.
422
// Unprocessable Entity, too many operations