By following the Google Apps Script > Rest API Node.js quickstart example I am able to complete the authentication process (follow the link, get a token, store the token)
but the script execution fails with the error message
The API returned an error: Error: Project title may not be empty.
The documentation for project.create() indicates the request body only need contain {title:string} which what the quickstart has.
Double check Google Apps Script API is enabled = yes,but the api enable page shows some html code it shouldn't, and the enable it for use url in the Overview sections of that page is broken.
I pretty sure the API is enabled as I see traffic in console.cloud
The method looks like this.
script.projects.create({
auth,
resource: {
title: 'My Script'
}
});
I also tried auth: auth as that is what I have seen working elsewhere (same error msg)
The error stack looks like this.
In other words, I followed the quick start exactly and checked function documentation to no avail, can some one help?
I think that your request body works. So can you confirm the following points?
- What version are you using? In my environment, googleapis with v25.0.0 - v30.0.0 cannot be worked. I confirmed that googleapis with v24.0.0 works fine.
- When you use v24.0.0, if your script use
var {google} = require('googleapis');
, please modify to var google = require('googleapis');
.
- Please confirm this page https://script.google.com/home/usersettings If the switch is turned off, please turn on. By this, Google Apps Script API can be used. When the switch is turned off, even if the scopes of Google Apps Script API are authorized, users cannot use the APIs.
Note :
- Unfortunately, after the version of v25.0.0, some bugs for APIs and the options are reported. I believe that these bugs are removed in the future. So if for APIs and the options you use, some errors occur, please modify the version of googleapis, and try again.
References :
- How do I update my google sheet in v4?
- Create a gmail filter with Gmail API nodejs, Error: Filter doesn't have any criteria
- Insufficient Permission when trying to create a folder on Google Drive via API(v3)
- Youtube Data API V3 - Error fetching video with google.youtube.videos.list()
- Google drive API - Cannot read property 'OAuth2' of undefined
If these points were not useful for your situation, I'm sorry.