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 

NameRequired
ensembleY

 

JSON parameters 

NameRequiredDescription

retry_policy

NHow to handle retries. Default: "simple". Options: "simple", "none"
error_policyNHow to handle errors. Default: "break". Options: "break", "continue"
ensemblesYJSON array containing one or multiple groups of requests
parallelNOption to execute requests in parallel. Default: false
requestsYJSON array containing one or multiple request definitions
idYUnique identifier used to identify the request in the combined response (e.g. "update_pixel_123")
serviceYAPI endpoint to serve the request (e.g. "user/current")
methodYAPI method. Options: "get", "put", "post", "delete"
paramsNAdditional request URL parameters (e.g. "id=123")
dataNAddition request body (e.g. "a=123&b=321" )
headersNJSON object that supports header definitions for that specific request
api_urlNThe 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"
                    }
                }
            ]
        }
    ]
}