我想做一个批量请求列表,可以带来发送者和标题的每一条消息与它一起在gmail api。如何批量请求?可以使用postman进行批量请求吗?
作为批量请求的一部分,如何请求批量请求?
如何对上述需求端点使用批处理请求?
As part of batch request as per google doc ,
POST /batch/farm/v1 HTTP/1.1
Authorization: Bearer your_auth_token
Host: www.googleapis.com
Content-Type: multipart/mixed; boundary=batch_foobarbaz
Content-Length: total_content_length
--batch_foobarbaz
Content-Type: application/http
Content-ID: <item1:12930812@barnyard.example.com>
GET /farm/v1/animals/pony
--batch_foobarbaz
Content-Type: application/http
Content-ID: <item2:12930812@barnyard.example.com>
PUT /farm/v1/animals/sheep
Content-Type: application/json
Content-Length: part_content_length
If-Match: "etag/sheep"
{
"animalName": "sheep",
"animalAge": "5"
"peltColor": "green",
}
--batch_foobarbaz
Content-Type: application/http
Content-ID: <item3:12930812@barnyard.example.com>
GET /farm/v1/animals
If-None-Match: "etag/animals"
--batch_foobarbaz--根据我的要求,我不知道如何修改单据请求?
发布于 2019-09-12 14:40:03
如何批量请求?
通过使用批处理端点Batching
可以使用postman进行批量请求吗?
是的,邮递员可以处理这个电话。但你将不得不手动创建正文,考虑到可以包含100个请求将非常耗时,并导致错误。
作为批处理请求的一部分,如何请求批处理请求?
通过发送HTTP Post,其中正文包含您正在请求数据的每个单个请求。
如何对上述需求端点使用批处理请求?
您可以使用postman或任何其他可以处理http post调用的编程语言来完成此任务。
正文中的每一行api都包含您希望向GET /farm/v1/animals发出的请求,在本例中应该类似于users/me/messages/1。
您需要调用users messages.list,首先获取您想要获取信息的所有消息ids的列表。然后建立对user.messages的批处理请求,以获取和请求每条消息。批处理并不意味着您不需要为每个消息发送get请求。批处理只是通过发送每个get请求来节省额外的http调用。
POST /batch/gmail/v1 HTTP/1.1
Authorization: Bearer your_auth_token
Host: www.googleapis.com
Content-Type: multipart/mixed; boundary=batch_foobarbaz
Content-Length: total_content_length
Accept-Encoding: application/gzip
--batch_foobarbaz
Content-Type: application/http
GET gmail/v1/users/me/messages/16d24956228a98c4
Accept: application/json; charset=UTF-8
--batch_foobarbaz
Content-Type: application/http
GET gmail/v1/users/me/messages/16d24956228a98c4
Accept: application/json; charset=UTF-8
--batch_foobarbaz--https://stackoverflow.com/questions/57899811
复制相似问题