lundi 3 novembre 2014

NodeJS GoogleAPIs mirror timeline insert returning 400 code with "required"


Vote count:

0




I'm trying to send a very simple Hello World message to the mirror API timeline in NodeJS with version 1.0.20 of the googleapis package, but I'm getting a response that isn't very helpful.



// OAuth is happening earlier and creating the proper auth tokens
googleapis.options({ auth: oAuth2Client });

mirror = googleapis.mirror('v1');
// This works fine and gives me a list of my current timeline
mirror.timeline.list({}, function(err, data) {console.log(err); console.log(data);})

// This results in an error
mirror.timeline.insert({'text':'Hello World'}, function(err, data) {console.log(err); console.log(data);})


The error I see is:



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


I've found a few other questions that see the same response, and they're all about missing inputs, but which input am I missing?



asked 34 secs ago

Josh B

995

1 Answer



Vote count:

0




After inspecting the in-code documentation, it appears that you need to wrap the normal parameters in a 'resource':



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


answered 34 secs ago

Josh B

995





NodeJS GoogleAPIs mirror timeline insert returning 400 code with "required"

Aucun commentaire:

Enregistrer un commentaire