Deploy Google Apps Script via REST API

110 views
Skip to first unread message

Rajkumar Gaur

unread,
Mar 16, 2022, 7:46:47 AM3/16/22
to Google Apps Script Community

Clark Lind

unread,
Mar 19, 2022, 1:11:45 PM3/19/22
to Google Apps Script Community
First, I just wanted to say your code is very clean and easy to read.
Based on what you shared, and not seeing the entire script, try adding   auth: this.auth,  to the deployment request. I don't know if it is required, but it is in your update function. 
Also, it shouldn't matter, but there is an extra comma after  manifestFileName: 'appsscript', <-- delete comma. 
Also consider adding a description (even if blank). 
Also try changing requestBody to resource.  

From the API: 
// Make sure the client is loaded and sign-in is complete before calling this method.
  function execute() {
      return gapi.client.script.projects.deployments.create({
        "resource": {
          "versionNumber": 1,
          "manifestFileName": "appsscript",
          "description": " "
        }
      })

Otherwise, from what I can see, your script should work.

Does it work if you manually try the API? (API)   
 
Reply all
Reply to author
Forward
0 new messages