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?

Josh B
  • 1,748
  • 16
  • 19

1 Answers1

2

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);})
Josh B
  • 1,748
  • 16
  • 19