Is there a way to improve the performance of the gmail API

0

I need to create a kind of "gmail client" in an application, for this I am using the gmail API. In my head it sounds pretty simple and it's working, after authentication I make a request to fetch messages from the user's inbox. But the request for routeA:

GET https://www.googleapis.com/gmail/v1/users/userId/messages

returns a JSON:

{"messages": [{ "id": "12c123c123c123c123", "threadId": "12c3123c123c123c"}]}

To build an INBOX similar to Gmail I would need basic information about each message, but for me to get this information I need to make a request for the routeB:

GET https://www.googleapis.com/gmail/v1/users/userId/messages/id

That is, for each inbox message I got with routeA, I need to make a request on routeB to get the basics of header information, this generates a lot of cost, if I put a number of "50" messages, exceeds the request. I'm only able to fetch 20 messages and it still takes ~ 5 to 7 seconds on average.

I wonder if this approach is the only one possible, or it would be better to build a mail server with IMAP and if using the API is the best solution if there is a way to improve this performance.

    
asked by anonymous 16.11.2018 / 16:25

0 answers