Reputation: 23
How can i post simple timeline message to glass with REST client. I have access token for the user. can any one please help. Thanks in advance.
I am getting following response in json format
{
"error": {
"errors": [{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission"
}],
"code": 403,
"message": "Insufficient Permission"
}
}
Upvotes: 2
Views: 501
Reputation: 50701
How are you providing the access token as part of the rest call? You should provide it as part of an Authorization
header indicating you have a bearer token. So the full HTTP request might look something like this, assuming your access token was "zzzzzzzzzzzzzzzzz"
POST /mirror/v1/timeline HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer zzzzzzzzzzzzzzzzz
Content-Type: application/json
Content-Length: 26
{ "text": "Hello world" }
See https://developers.google.com/glass/timeline for this example and more details.
If you are trying to do this with curl, your command might look something like
curl --header "Authorization: Bearer zzzzzzzzzzzzzzzzz" \
--header "Content-type: application/json" \
--data '{ "text": "Hello world" }' \
https://www.googleapis.com/mirror/v1/timeline
It is generally best to use one of the libraries, which will help manage authentication for you. Is there a reason you're using raw HTTP/REST?
Upvotes: 3