Google Calendar V3 REST API中的批量请求 [英] Batch request in Google Calendar V3 REST API
问题描述
如何通过V3 REST API使用批量请求获取/添加/更新Google日历事件?我试过了,但没有成功。根据文档( https://developers.google.com/google-apps/calendar/批量),应该可以通过向API发布多部分/混合内容类型消息来发送批量请求。一个正在运行的HTTP POST的例子会很棒。
How to get/add/update Google Calendar Events using batch request through V3 REST API? I've tried and but not works. According to the docs (https://developers.google.com/google-apps/calendar/batch) it should be possible to send a batch request by posting a multipart/mixed content type message to the API. An example of a working HTTP POST would be great.
谢谢,
Riyaz
Thanks, Riyaz
推荐答案
以下批处理请求获取eventId1,更新eventId2并在日历标识下使用calendarId标识新建事件。
The following batch request, gets the eventId1, updates the eventId2 and creates a new event under calender that is identified with 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--
这篇关于Google Calendar V3 REST API中的批量请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!