Class: Batch

Batch(requests, optional)

In many cases, it may be desirable to execute multiple requests at once. For example, when synchronizing the catalog of items in a periodical manner, you would have to execute a sequence of thousands of separate POST requests, which is very ineffective and may take a very long time to complete. Most notably, network latencies can make execution of such sequence very slow and even if executed in multiple parallel threads, there will still be unreasonable overhead caused by the HTTP(s). To avoid the mentioned problems, batch processing may be used, encapsulating a sequence of requests into a single HTTPS request. Batch processing allows you to submit arbitrary sequence of requests and the batch may combine different types of requests arbitrarily as well. Note that the status code of the batch request itself is 200 even if the individual requests result in error – you have to inspect the code values in the resulting array.

Constructor

new Batch(requests, optional)

Construct the request
Parameters:
Name Type Description
requests Array.<Request> Array containing the requests.
optional Object Optional parameters given as an object with structure name of the parameter: value - Allowed parameters: - *distinctRecomms* - Type: boolean - Description: Makes all the recommended items for a certain user distinct among multiple recommendation requests in the batch.
Source:

Methods

bodyParameters() → {Object}

Get body parameters
Source:
Returns:
The values of body parameters (name of parameter: value of the parameter)
Type
Object

queryParameters() → {Object}

Get query parameters
Source:
Returns:
The values of query parameters (name of parameter: value of the parameter)
Type
Object