Want to make a batch request for listing that can bring sender and title of each message along with it in gmail api. how can I make a batch request for it? Is it possible to make a batch request using postman?
As part of batch request, how batch request can be requested ?
how can I use batch request for above requirement endpoints?
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:[email protected]>
GET /farm/v1/animals/pony
--batch_foobarbaz
Content-Type: application/http
Content-ID: <item2:[email protected]>
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:[email protected]>
GET /farm/v1/animals
If-None-Match: "etag/animals"
--batch_foobarbaz--
as per my requirement, I don't get how doc request can be modified?
By using the batching end point Batching
Yes postman can handle this call. But you will have to manually create the body which considering can contain 100 requests is going to be very time consuming and pron to error IMO.
By sending a HTTP Post where the body contains each of the single requests you are requesting data for.
You can do it with postman or any other programming language that can handle http post calls.
each line
GET /farm/v1/animals
in the body contains the request that you wish to make to the api in your case it would be something likeusers/me/messages/1
.You will need to call users messages.list first get a list of all the message ids that you want to get information for. Then build up your batch request to the user.messages to get and request each message. Batching will not mean that you dont need to send a get request for each message batching just saves you the extra http calls made by sending each get request.