on 2012 Sep 29 5:19 PM
Request clarification before answering.
Hi Jibin
I just did a successful $batch request similar to yours, same headers with 2 GET operations
--batch
Content-Type: application/http
Content-Transfer-Encoding: binary
GET Contacts('BARG') HTTP/1.1
--batch
Content-Type: application/http
Content-Transfer-Encoding: binary
GET Contacts('BARS') HTTP/1.1
--batch
I believe that you need to ensure proper spacing between the GET operation and the following -batch
eg. above has three carriage returns after the GET, if i remove one i get
"The Data Services Request could not be understood due to malformed syntax"
when trying to POST
Hope it helps
JSP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jibin
Its not a bug its how multipart calls work.
You may want to look at RFC 2046, it discusses in detail how multipart boundary rules work, in particular the use of CRLF's for padding between sections. Its the same for emails, images etc
I would suggest however that you should be using one of the many OData Client Libraries which abstract the need to know such details.
There is a lot more to $batch calls, a library like datajs makes it easy for developers.
eg.
--batch_70a5-6b9b-ac07
Content-Type: multipart/mixed; boundary=changeset_0cf1-85e5-364b
--changeset_0cf1-85e5-364b
Content-Type: application/http
Content-Transfer-Encoding: binary
POST Contacts HTTP/1.1
Content-Length: 154
Content-Type: application/json
Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1
DataServiceVersion: 1.0
MaxDataServiceVersion: 2.0
{"Email":"","Mimetype":"","Avatar":"","PhoneMobile":"","PhoneOffice":"","PhoneHome":"","CatchPhrase":"Doh","LastName":"Simpson","FirstName":"Homer","Handle":""}
--changeset_0cf1-85e5-364b
Content-Type: application/http
Content-Transfer-Encoding: binary
POST Contacts HTTP/1.1
Content-Length: 154
Content-Type: application/json
Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1
DataServiceVersion: 1.0
MaxDataServiceVersion: 2.0
{"Email":"","Mimetype":"","Avatar":"","PhoneMobile":"","PhoneOffice":"","PhoneHome":"","CatchPhrase":"Doh","LastName":"Si","FirstName":"FFF","Handle":""}
--changeset_0cf1-85e5-364b--
--batch_70a5-6b9b-ac07--
Cheers
JSP
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.