Friday 15 July 2011

node.js - NodeJS GoogleAPIs mirror timeline insert returning 400 code with "required" -



node.js - NodeJS GoogleAPIs mirror timeline insert returning 400 code with "required" -

i'm trying send simple hello world message mirror api timeline in nodejs version 1.0.20 of googleapis package, i'm getting response isn't helpful.

// oauth happening before , creating proper auth tokens googleapis.options({ auth: oauth2client }); mirror = googleapis.mirror('v1'); // works fine , gives me list of current timeline mirror.timeline.list({}, function(err, data) {console.log(err); console.log(data);}) // results in error mirror.timeline.insert({'text':'hello world'}, function(err, data) {console.log(err); console.log(data);})

the error see is:

{ errors: [ { domain: 'global', reason: 'required', message: 'required' } ], code: 400, message: 'required' }

i've found few other questions see same response, , they're missing inputs, input missing?

after inspecting in-code documentation, appears need wrap normal parameters in 'resource':

// works! mirror.timeline.insert({'resource':{'text':'hello world'}}, function(err, data) {console.log(err); console.log(data);})

node.js google-glass google-api-nodejs-client

No comments:

Post a Comment