2
votes

I am trying the Google Glass Mirror APIs now. My test app is a simple node.js/express server with googleapis (https://github.com/google/google-api-nodejs-client).

So far I could do almost all the basic operations of timelines successfully, such as list/get/update/delete, without attachments. Here is how I insert a timeline card:

var googleapis = require('googleapis');
app.all('/timeline_insert', function(req, res) {
  var timeline = {'text': req.query.text};
  googleapis.discover('mirror', 'v1')
        .execute(function(err, client) {
      client.mirror.timeline.insert({resource: timeline})
                        .withAuthClient(oauth2client)
                .execute(function(err, result) {
          // ...
      });
  });

}

Now I want to go one more step further to test the attachment features. However, I have no idea how to use the APIs via googleapis and node.js. Is there any sample code for the attachment operations, such as insert/get? I know I can always use raw HTTP format to do it. But since googleapis already provides the APIs, I just want to directly use them. Thanks.

1

1 Answers

0
votes

The Node.js client library, which is based on the JavaScript client library, has no built-in support for media upload: you will need to build the request "manually".

This answer should help you get started on building this request.

More information on Google's media upload protocol can be found in our documentation.