Batching
In order to reduce the number of API calls for mass updates the system allows to batch requests into a single HTTP call. To make this work, some prerequisites have to be met:
- As the URL query string is the same for all contained requests, the URL needs to be a valid URL for every contained request. In other words: Only objects of the same type and the same operation can be batched together.
- The batched request body needs to be valid JSON. So batching simply means that the request bodies of individual requests are placed into a wrapping array in full (see example below).
- The responses will equally be batched (i.e. an array of response bodies).
- Every request is processed individually. I.e. one can fail while another one can succeed. There is no “all or nothing” or transactional logic across requests.
Example:
[
{
"operationType":"update",
"data":{
"typedId":"148.P",
"label":"Test2"
},
"oldValues":{
"currency":"EUR",
"lastUpdateDate":"2011-05-03",
"label":"Test",
"sku":"001",
"unitOfMeasure":"EA",
"version":0,
"typedId":"148.P"
}
},
{
"operationType":"update",
"data":{
"typedId":"148.P",
"label":"Test2"
},
"oldValues":{
"currency":"EUR",
"lastUpdateDate":"2011-05-03",
"label":"Test",
"sku":"001",
"unitOfMeasure":"EA",
"version":0,
"typedId":"148.P"
}
}
]