aashrayagarwal
aashrayagarwal

Reputation: 61

Clarification regarding gmail message apis

What is the Order in which the message list returns the messages. i.e message.list api? Whether it is based on the message timestamp or any other field.

If I want to sync a very large mailbox and I fire a message.list api, then I get a pageToken for pagination, so how long is the pageToken valid? For eg if I get a page token X and I fire the api to fetch the next page after 6-7 hours will I still get the expected response. As this pageToken validity is not mentioned in the gmail api doc, any approach on how can full mail sync be done if the service which is syncing the mailbox restarts.

Upvotes: 0

Views: 45

Answers (1)

Alexey
Alexey

Reputation: 626

If I remember correctly the order of returned emails is "newest first, to older ones". I don't believe a pageToken would expire in 6-7 hours but why would you wait for so long to get the next page? If you care about getting new emails a few hours later then you want to use the history methods, starting with startHistoryId that you get from your full load.

Upvotes: 1

Related Questions