Specify request body in Google API calls (using Google APIs Client Library for JavaScript)

Viewed 4274

I am trying to call Google API method drive.files.insert to create a folder in Google Drive with a request like this (using Google APIs Client Library for JavaScript):

var request = gapi.client.drive.files.insert({'convert': 'false', 'ocr': 'false'});
request.execute(function(resp) { console.log(resp); });

The problem is that I need to specify some params in the request body, for example:

{
    "title":"testFolder",
    "description":"hello world",
    "mimeType":"application/vnd.google-apps.folder"
}

But I cannot figure it out how to specify these parameters with the Google APIs Client Library for JavaScript. Is there any suggestion of how I can achieve this?

3 Answers
Related