Reputation: 48
I want to make a batch request (get, insert, update, delete) to Google calendar api v3 from Salesforce.com, I'm using http request, the problem is that I can't find the endpoint for batch request in the google documentation, there is an fictional demo on the documentation but is no clear.
Somebody know the endpoint to make the batch request for google calendar api v3?
I have tried the following to request the batch, using OAuth 2.0 Playground tool:
POST /batch HTTP/1.1
Host: www.googleapis.com
Content-length: 91
Content-type: multipart/mixed; boundary=batch_foobarbaz
Authorization: Bearer we28.1.AADtN_Xs2wsTqnathLdU-X0q1Zwur2Rhi4AossFeGlbaPeavLZ6u5Jm4L3sTbuY
--batch_foobarbaz
Content-Type: application/http
GET /calendar/v3/calendars/primary/events
But I get this error:
HTTP/1.1 500 Internal Server Error
Content-length: 13
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Server: GSE
Pragma: no-cache
Cache-control: no-cache, no-store, max-age=0, must-revalidate
Date: Wed, 30 Apr 2014 21:29:50 GMT
X-frame-options: SAMEORIGIN
Content-type: text/html; charset=UTF-8
Unknown Error
Someone idea how to make it work?
Upvotes: 3
Views: 685
Reputation: 5529
The endpoint is
https://www.googleapis.com/batch
That works for me when I do Calendar batch requests. One problem I had was with my last boundary token I didn't have the -- after it. So each token starts with --
and the last one has --
at the end. You will also have to do what @Vinicius Pinto says.
Upvotes: 1
Reputation: 8289
Your request is missing the end marker, it should be:
POST /batch HTTP/1.1
Host: www.googleapis.com
Content-length: 91
Content-type: multipart/mixed; boundary=batch_foobarbaz
Authorization: Bearer we28.1.AADtN_Xs2wsTqnathLdU-X0q1Zwur2Rhi4AossFeGlbaPeavLZ6u5Jm4L3sTbuY
--batch_foobarbaz
Content-Type: application/http
GET /calendar/v3/calendars/primary/events
--batch_foobarbaz--
See a full example here.
Upvotes: 1