public class BatchAPIRequest extends BoxJSONRequest
The request itself is a BoxJSONRequest but extends it to provide additional functionality for aggregating a bunch of requests and responding with multiple responses as if the requests were called individually
BoxAPIRequest.RequestHeader
Modifier and Type | Field and Description |
---|---|
static URLTemplate |
BATCH_URL_TEMPLATE
Batch URL Template.
|
Constructor and Description |
---|
BatchAPIRequest(BoxAPIConnection api)
Constructs an authenticated BatchRequest using a provided BoxAPIConnection.
|
Modifier and Type | Method and Description |
---|---|
List<BoxAPIResponse> |
execute(List<BoxAPIRequest> requests)
Execute a set of API calls as batch request.
|
protected List<BoxAPIResponse> |
parseResponse(BoxJSONResponse batchResponse)
Parses btch api response to create a list of BoxAPIResponse objects.
|
protected void |
prepareRequest(List<BoxAPIRequest> requests)
Prepare a batch api request using list of individual reuests.
|
bodyToString, getBodyAsJsonObject, setBody, setBody
addHeader, getBody, getHeaders, getMethod, getUrl, resetBody, send, send, setBody, setBody, setConnectTimeout, setFollowRedirects, setReadTimeout, toString, writeBody
public static final URLTemplate BATCH_URL_TEMPLATE
public BatchAPIRequest(BoxAPIConnection api)
api
- an API connection for authenticating the request.public List<BoxAPIResponse> execute(List<BoxAPIRequest> requests)
requests
- list of api requests that has to be executed in batch.protected void prepareRequest(List<BoxAPIRequest> requests)
requests
- list of api requests that has to be executed in batch.protected List<BoxAPIResponse> parseResponse(BoxJSONResponse batchResponse)
batchResponse
- response of a batch api request