Gmail API all messages

I need to get all messages in my inbox using gmail api. But I see only one way to do this.

  • Get a list of messages (id, threadID)

    GET https://www.googleapis.com/gmail/v1/users/somebody%40gmail.com/messages?labelIds=INBOX&key={YOUR_API_KEY}
    
  • With identification `` get all messages in the loop

    While 
        GET https://www.googleapis.com/gmail/v1/users/somebody%40gmail.com/messages/147199d21bbaf5a5?key={YOUR_API_KEY}
    End of While
    

But for this you need 100500 requests. Does anyone know how to get all messages with one request (or just a payload field)?

+4
source share
2 answers

Use the package and request 100 messages at a time. You will need to make 1000 requests, but the good news is that it is very good and it will be easier for everyone (without downloading 1 GB of response in one request!).

: https://developers.google.com/gmail/api/guides/batch

, , Gmail Api , Stack Overflow, , .

+12

, , , API GetAll API .

:

(, ) - Google. ? .

Google , . Google , - . , , DDoS- Google.

- API , . , Google , , .

.

+2

Source: https://habr.com/ru/post/1547793/


All Articles