I have an Angular 6 application. I am attempting to retrieve my email messages from my gmail account by connect to Google’s API.
This link here explains how:
https://developers.google.com/gmail/api/v1/reference/users/messages/get#examples
It says to call this endpoint with your userId and message id:
https://www.googleapis.com/gmail/v1/users/userId/messages/id
The problem is, I have no idea what my userId or message id are. How do I figure that out?
PS - I’m not using the gapi client library or any library because I’m trying to program the application to be able to hit any API endpoint, not just Google’s.
As explained in the docs you linked to...
/**
* Get Message with given ID.
*
* @param service Authorized Gmail API instance.
* @param userId User's email address. The special value "me"
* can be used to indicate the authenticated user.
* @param messageId ID of Message to retrieve.
* @return Message Retrieved Message.
* @throws IOException
*/
userId: User's email address. The special value "me" can be used to indicate the authenticated user.
I imagine you'd find the message id by inspecting an individual message object with the API. If you don't know any message ID's, logically you won't be able to inspect an individual message, you'd need to grab all the messages and then pick one.