Google Calendar V3 REST API Batch Request

How to get / add / update Google Calendar events using batch request via V3 REST API? I tried and did not work. According to the docs ( https://developers.google.com/google-apps/calendar/batch ), you can send a batch request by sending a message like multipart / mixed content type to the API. An example of a working HTTP POST would be great.

Thanks Riyaz

+6
source share
2 answers

The next batch request receives eventId1, updates eventId2 and creates a new event under the calendar, which is identified using calendarId.

POST /batch HTTP/1.1 Authorization: /*Auth token*/ Host: host Content-Type: multipart/mixed; boundary=batch_foobarbaz Content-Length: total_content_length --batch_foobarbaz Content-Type: application/http Content-ID: <item1: x@barnyard.example.com > GET /calendar/v3/calendars/calendarId/events/eventId1 --batch_foobarbaz Content-Type: application/http Content-ID: <item2: x@barnyard.example.com > PUT /calendar/v3/calendars/calendarId/events/eventId2 Content-Type: application/json Content-Length: part_content_length {{ body }} --batch_foobarbaz Content-Type: application/http Content-ID: <item3: x@barnyard.example.com > POST /calendar/v3/calendars/calendarId/events Content-Type: application/json Content-Length: part_content_length {{ body }} --batch_foobarbaz-- 
+1
source

End point

https://www.googleapis.com/batch

This works for me when I execute batch requests on a calendar. One of the problems I have been facing is my last border token. After that I did not have -- . Thus, each token begins with -- , and the last has -- at the end. As the @Burcu Dogan example shows.

0
source

Source: https://habr.com/ru/post/948541/


All Articles