Is there a way using gmail rest API to get the oldest UNREAD mail or list eg. 10 oldest UNREAD mails?
Right now i am getting all unread mails from a specific email folder by looping using nextPage until i reach the last page. There i get the last message id, which seems to refer to the oldest email. I works and the mail id's seems to be listed in order newest first and oldest last in the list.
This is the query i am using:
https://gmail.googleapis.com/gmail/v1/users/a.b@gmail.com/messages?labelIds="folderI"&includeSpamTrash=false&pageToken="nextPage"&q=is:unread
Is there a more effective way to get the oldest UNREAD mail or to get a list of say the 10 oldest UNREAD mails?