Google Calendar V3 REST API中的批量请求

Riy*_*raf 6 rest http google-calendar-api gdata-api google-api

如何通过V3 REST API使用批量请求获取/添加/更新Google Calendar事件?我试过但不行.根据文档(https://developers.google.com/google-apps/calendar/batch),应该可以通过向API发布多部分/混合内容类型消息来发送批处理请求.工作HTTP POST的一个例子很棒.

谢谢,Riyaz

Bur*_*gan 1

以下批处理请求获取 eventId1,更新 eventId2 并在 calender 下创建一个用 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--
Run Code Online (Sandbox Code Playgroud)