Im playing around with Googles official js client for accessing Google APIs and in this case Google Glass Mirror API.
I need some guidance on how to use the update
or even better patch
methods (see https://developers.google.com/glass/v1/reference/timeline) to update timeline card that I previously inserted into the timeline.
Inserting and listing was fairly easy and works successfully. I have used this tutorial to getting started: https://github.com/emil10001/glass-mirror-nodejs-auth-demo/blob/master/app.js
I have tried following:
card = {
"kind": "mirror#timelineItem",
"id": "74b88eb3-a6d7-4c13-8b0e-bfdecf71c913",
"created": "2014-05-22T20:26:56.253Z",
"updated": "2014-05-22T20:27:18.961Z",
"etag": "1400790438961",
"text": "This item3 auto-resizes according to the text length",
"notification": {
"level": "DEFAULT"
}
}
client
.mirror.timeline.update({"id": card.id, resource: card})
.withAuthClient(oauth2Client)
.execute(function (err, data) {
if (!!err)
errorCallback(err);
else
successCallback(data);
});
and I get successfull response with following payload:
{
kind: 'mirror#timelineItem',
id: '74b88eb3-a6d7-4c13-8b0e-bfdecf71c913',
selfLink: 'https://www.googleapis.com/mirror/v1/timeline/74b88eb3-a6d7-4c13-8b0e-bfdecf71c913',
created: '2014-05-22T20:26:56.253Z',
updated: '2014-05-22T20:32:11.862Z',
etag: '1400790731862'
}
What I end up with is card with empty content. I suspect that I'm not using update method correctly and the the second parameter resource
is not correctly named?