Bulk Requests (Ensemble)
The data service will allow you to combine multiple API requests in an efficient way. You can mix sequential calls with parallel requests.
Contents of this page |
---|
POST /api/ensemble
Endpoint
/api/ensemble
Method
POST
Request parameters
Name | Required |
---|---|
ensemble | Y |
JSON parameters
Name | Required | Description |
---|---|---|
retry_policy | N | How to handle retries. Default: "simple". Options: "simple", "none" |
error_policy | N | How to handle errors. Default: "break". Options: "break", "continue" |
ensembles | Y | JSON array containing one or multiple groups of requests |
parallel | N | Option to execute requests in parallel. Default: false |
requests | Y | JSON array containing one or multiple request definitions |
id | Y | Unique identifier used to identify the request in the combined response (e.g. "update_pixel_123") |
service | Y | API endpoint to serve the request (e.g. "user/current") |
method | Y | API method. Options: "get", "put", "post", "delete" |
params | N | Additional request URL parameters (e.g. "id=123") |
data | N | Addition request body (e.g. "a=123&b=321" ) |
headers | N | JSON object that supports header definitions for that specific request |
api_url | N | The url of the API endpoint to use. Defaults to current environment |
Parameter description
ensemble - contains a string representation of a JSON object array as shown below.
{ "retry_policy": "simple", "error_policy": "break", "ensembles": [ { "requests": [ { "id": "tracking_before", "service": "tracking/beacon", "method": "get" } ] }, { "parallel": true, "requests": [ { "id": "update_pixel_123", "service": "tracking/beacon", "method": "put", "params": "id=123", "data": "name=new_name" }, { "id": "create_pixel", "service": "tracking/beacon", "method": "post", "data": "type=pixel&name=test_two&tracking_group=321" } ] }, { "requests": [ { "id": "tracking_after", "service": "tracking/beacon", "method": "get", "headers": { "Accept": "application/json" } } ] } ] }