I'm using the googleapis package to create a new Google Spreadsheet and it fails. The same request works when I use the web-based tools in the Google API documentation.
Google.prototype.createSheet = function(filename, callback) {
var services = google.sheets('v4');
services.spreadsheets.create({
properties : {title:filename},
auth : this.auth
}, function(err,response) {
if( err ) {
console.log('Error : unable to create file, ' + err);
return;
} else {
console.dir(response);
}
});
}
The result,
Error : unable to create file, Error: Invalid JSON payload received. Unknown name "properties": Cannot bind query parameter. Field 'properties' could not be found in request message.
I've also tried using a property name of "resource" instead of "properties" because I found that in other sheets endpoints. That also didn't work but resulted in both a different error message but also a different API request when I debug the googleapis code.
Error : unable to create file, Error: Invalid JSON payload received. Unknown name "title" at 'spreadsheet': Cannot find field.
I've also tried creating the file using the Drive API without success.