You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2014/04/03 10:52:57 UTC
svn commit: r1584286 -
/olingo/site/trunk/content/doc/tutorials/batchClientApi.mdtext
Author: chrisam
Date: Thu Apr 3 08:52:57 2014
New Revision: 1584286
URL: http://svn.apache.org/r1584286
Log:
CMS commit to olingo by chrisam
Added:
olingo/site/trunk/content/doc/tutorials/batchClientApi.mdtext (with props)
Added: olingo/site/trunk/content/doc/tutorials/batchClientApi.mdtext
URL: http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/tutorials/batchClientApi.mdtext?rev=1584286&view=auto
==============================================================================
--- olingo/site/trunk/content/doc/tutorials/batchClientApi.mdtext (added)
+++ olingo/site/trunk/content/doc/tutorials/batchClientApi.mdtext Thu Apr 3 08:52:57 2014
@@ -0,0 +1,86 @@
+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<String>)
+
+ 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<String>)
+ - contentId(String)
+ - body(String)
+
+ Map<String, String> changeSetHeaders = new HashMap<String, String>();
+ 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<BatchPart> batchParts = new ArrayList<BatchPart>();
+ 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<BatchSingleResponse> responses = EntityProvider.parseBatchResponse(responseBody, contentType);
+ for (BatchSingleResponse response : responses) {
+ response.getStatusCode());
+ response.getStatusInfo());
+ response.getHeader(HttpHeaders.CONTENT_TYPE);
+ response.getBody();
+ response.getContentId();
+
+}
\ No newline at end of file
Propchange: olingo/site/trunk/content/doc/tutorials/batchClientApi.mdtext
------------------------------------------------------------------------------
svn:eol-style = native