0

I am using drive.comments.insert to insert a comment into a Google Drive document. This worked with a previous version of googleapis with a previous version of node, but now, with the exact same code, it is returning a 400 Resource metadata required error from Google.

Here's what I'm doing in node:

  oauth2Client.credentials = {access_token: req.user.google.token, refresh_token: req.user.google.refresh}
    googleapis
    .discover('drive', 'v2')
    .execute(function(err, client){
      var body = {content:'asdf'};
      var ins = client.drive.comments.insert({fileId: '{A correct fileId here}', resource: body})
      ins.withAuthClient(oauth2Client)
      .execute(function(err, results) {
        console.log(results)
        if(err) console.log('unable to add comments', err)
      })
    })

Please let me know if I am using the new version correctly.

Thanks!

Edward Sun
  • 1,541
  • 3
  • 15
  • 26

1 Answers1

0

Pass the body as the second argument:

client.drive.comments.insert({fileId: '{A correct fileId here}', body)
Burcu Dogan
  • 9,153
  • 4
  • 34
  • 34