Reputation: 1
I need help on to Read Unreaden emails count / send an email to specific or group of people and search with senders id or date to find a specific email using API Only, no programming I did the action like this https://www.googleapis.com/gmail/v1/users/gmailid@gmail/profile on the browser and i got the output like below
{
"error": {
"errors": [{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}],
"code": 401,
"message": "Login Required"
}
}
I know, i have to pass oAuth token or client id and client secreat to the url, but i dont know how can i pass that info through URL.
Also i tried in Post-Man and i could not able tocreate the oAuth token, it is asking call back and redirect url that i dno know.
Can some body give me the idea pleaseI need only API Solution, because i need to work on API stuff, i can successfully implemented the same using java. But i could not able to do this using API ( Am not using any programming to handle the API, only Browser calls and most likely Post-Man only)
Upvotes: 0
Views: 188
Reputation: 2608
You only need the access token to do the HTTP request. In this case, the syntax to get the Gmail profile would be this:
https://www.googleapis.com/gmail/v1/users/USERID/profile?access_token=ACCES_TOKEN
You can easily request the tokens (and do HTTP requests) in the OAuth 2.0 Playground. You can also read more about the getProfile request of the Gmail API here.
EDIT:
To get the number of unread messages, you have to use the q
parameter, and change your request to messages
:
https://www.googleapis.com/gmail/v1/users/me/messages?q=is:unread&access_token=ACCESS_TOKEN
Upvotes: 0