Title: Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at . http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Batch Request construction -------------------------- **Query Request construction** A BatchQueryPart is a representation of a single retrieve request. You can use the following methods in order to fill out a request: - method(String) - uri(String) - contentId(String) - headers(List)

BatchQueryPart request = BatchQueryPart.method("GET").uri("$metadata").build();
**Note:** The valid method value is GET. **ChangeSet construction** A BatchChangeSetPart is a representation of a single change request. You can use the following methods in order to fill out a change request: - method(String) - uri(String) - headers(List) - contentId(String) - body(String)
Map changeSetHeaders = new HashMap();
changeSetHeaders.put("content-type", "application/json;odata=verbose");
BatchChangeSetPart changeRequest = BatchChangeSetPart.method("PUT")
.uri("Employees('2')/EmployeeName")
.headers(changeSetHeaders)
.body("{\"EmployeeName\":\"Frederic Fall MODIFIED\"}")
.build();
...
**Note:** The valid method values are POST, PUT, DELETE or MERGE. The change request has to become a part of a changeSet. For that you need to create a changeSet object and to attach the change request to this object. ... BatchChangeSet changeSet = BatchChangeSet.newBuilder().build(); changeSet.add(changeRequest); **Batch request payload construction** After you collected all created parts, you can call the method writeBatchRequestBody(..) provided by EntityProvider ... List batchParts = new ArrayList(); batchParts.add(request); batchParts.add(changeSet); InputStream payload = EntityProvider.writeBatchRequest(batchParts, BOUNDARY); The second parameter BOUNDARY is necessary information for the construction of the batch request payload. It is the value of the boundary parameter, that is set in Content-Type header of the batch request. **Batch Response interpretation** Interpretation of the batch response payload You receive a list of single response by calling EntityProvider.parseBatchResponse(..) List responses = EntityProvider.parseBatchResponse(responseBody, contentType); for (BatchSingleResponse response : responses) { response.getStatusCode()); response.getStatusInfo()); response.getHeader(HttpHeaders.CONTENT_TYPE); response.getBody(); response.getContentId(); }