【发布时间】:2013-12-22 05:11:43
【问题描述】:
我正在尝试了解(并最终使其工作)google group API 上的批处理请求。
通过Oauth2 Playground,我知道如何使用以下命令执行单个请求:
第 1 步授权的 API 是
https://www.googleapis.com/auth/admin.directory.group.member.readonly
https://www.googleapis.com/auth/admin.directory.group.member
https://www.googleapis.com/auth/admin.directory.group.readonly
https://www.googleapis.com/auth/admin.directory.group
在第 3 步中,我提出了一个发帖请求:
请求 URI:https://www.googleapis.com/admin/directory/v1/groups/mytestgroup@domain.ext/members
身体是:
{
“电子邮件”:“lya@example.com”,
“角色”:“成员”
}
到目前为止一切都很好,但现在我正在尝试在批处理请求中做同样的事情
我试着按照这里的解释:
https://developers.google.com/admin-sdk/directory/v1/guides/batch#example
但是我没看懂,所以我去了那里:
https://developers.google.com/storage/docs/json_api/v1/how-tos/batch
所以我在第 1 步使用相同的 API 但在第 3 步执行了以下请求:
发帖请求至:
https://www.googleapis.com/batch
使用自定义内容类型:
标题现在是
multipart/mixed;边界="batch_foobarbaz"
并在正文请求中:
--batch_foobarbaz
内容类型:application/http
POST /admin/directory/v1/groups/mytestgroup@domain.ext/members HTTP/1.1内容类型:应用程序/json
内容长度:58
{
“电子邮件”:“liz@example.com”,
“角色”:“成员”
}--batch_foobarbaz--
我也尝试了不同的变体,但我从来没有做出正确的请求,我系统地得到 400 错误。
有人可以帮我解决这个问题,我不知道我能做些什么来纠正这个问题。
在此先感谢,哈罗德
【问题讨论】:
标签: batch-processing google-groups-api oauth2-playground