Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
TL;DR: Use the versioned deployment id instead of the script id. After repeating the procedures, step by step multiple times, I tried adding the resource.devMode property to the Apps Script REST...
Answer
#4: Post edited
After repeating the procedures, step by step multiple times, I tried adding the `devMode` parameter to the Apps Script Execution API call and setting it to `true`. This call is in `index.js` file and refers to `gapi.client.script.scripts.run`. The modified call looks as shown below- ```javascript
- gapi.client.script.scripts.run({
- 'scriptId': scriptId,
- 'resource': {
- 'function': 'getFoldersUnderRoot',
- 'devMode': true
- }
- ```
- Surprisingly, with this parameter, the code work. For those new to Apps Script, the development mode only works for the project owner for projects stored in My Drive units and for users having edit access for projects stored in Shared Drives, so this "solution" can't be used on "production".
- After sleeping one night, I tried replacing the script id with the deployment id, without the `devMode` parameter... **Voila! It worked!**.
- So the documentation on the following page looks to be incomplete.
- https://developers.google.com/apps-script/api/reference/rest/v1/scripts/run#path-parameters
- Current content:
- ### Path parameters
- #### Parameters
- <table>
- <tr>
- <td>scriptId</td><td>string</td><td>The script ID of the script to be executed. Find the script ID on the Project settings page under "IDs."</td>
- </tr>
- </table>
The description should say that the script ID work when using `devMode`, and it's set to `true`. When it's omitted or set to `false`, use the deployment id instead of the script id.The deployment id is shown when creating a new deployment. Can be found by opening Google Apps Script, opening the project, and clicking on Deploy > Manage Deployments. The dialog shows the deployment id and a button to copy it to the clipboard.
- TL;DR: Use the **versioned deployment id** instead of the script id.
- ---
- After repeating the procedures, step by step multiple times, I tried adding the `resource.devMode` property to the Apps Script REST API call and setting it to `true`. This call is in `index.js` file and refers to `gapi.client.script.scripts.run`. The modified call looks as shown below
- ```javascript
- gapi.client.script.scripts.run({
- 'scriptId': scriptId,
- 'resource': {
- 'function': 'getFoldersUnderRoot',
- 'devMode': true
- }
- ```
- Surprisingly, with this parameter, the code work. For those new to Apps Script, the development mode only works for the project owner for projects stored in My Drive units and for users having edit access for projects stored in Shared Drives, so this "solution" can't be used on "production".
- After sleeping one night, I tried replacing the script id with the deployment id, without the `devMode` parameter... **Voila! It worked!**.
- So the documentation on the following page looks to be incomplete.
- https://developers.google.com/apps-script/api/reference/rest/v1/scripts/run#path-parameters
- Current content:
- ### Path parameters
- #### Parameters
- <table>
- <tr>
- <td>scriptId</td><td>string</td><td>The script ID of the script to be executed. Find the script ID on the Project settings page under "IDs."</td>
- </tr>
- </table>
- The description should say that the script ID, the *head deployment id*, works when using `resource.devMode`, and it's set to `true`. When omitted or set to `false`, *use the **versioned deployment id*** instead of the script id.
- The *versioned deployment id* is shown when creating a new deployment. Can be found by opening Google Apps Script, opening the project, and clicking on Deploy > Manage Deployments. The dialog shows the versioned deployment id and a button to copy it to the clipboard.
- ---
- Notes:
- I found this question ["Requested entity was not found." - Apps Script Execution API error](https://stackoverflow.com/q/49206863/1595451). I got the idea of using `resource.devMode` property from [Tanaike's answer](https://stackoverflow.com/a/49207288/1595451).
#3: Post edited
- After repeating the procedures, step by step multiple times, I tried adding the `devMode` parameter to the Apps Script Execution API call and setting it to `true`. This call is in `index.js` file and refers to `gapi.client.script.scripts.run`. The modified call looks as shown below
- ```javascript
- gapi.client.script.scripts.run({
- 'scriptId': scriptId,
- 'resource': {
- 'function': 'getFoldersUnderRoot',
- 'devMode': true
- }
- ```
Surprisingly, with this parameter, the code work.- After sleeping one night, I tried replacing the script id with the deployment id, without the `devMode` parameter... **Voila! It worked!**.
- So the documentation on the following page looks to be incomplete.
- https://developers.google.com/apps-script/api/reference/rest/v1/scripts/run#path-parameters
- Current content:
- ### Path parameters
- #### Parameters
- <table>
- <tr>
- <td>scriptId</td><td>string</td><td>The script ID of the script to be executed. Find the script ID on the Project settings page under "IDs."</td>
- </tr>
- </table>
- The description should say that the script ID work when using `devMode`, and it's set to `true`. When it's omitted or set to `false`, use the deployment id instead of the script id.
- The deployment id is shown when creating a new deployment. Can be found by opening Google Apps Script, opening the project, and clicking on Deploy > Manage Deployments. The dialog shows the deployment id and a button to copy it to the clipboard.
- After repeating the procedures, step by step multiple times, I tried adding the `devMode` parameter to the Apps Script Execution API call and setting it to `true`. This call is in `index.js` file and refers to `gapi.client.script.scripts.run`. The modified call looks as shown below
- ```javascript
- gapi.client.script.scripts.run({
- 'scriptId': scriptId,
- 'resource': {
- 'function': 'getFoldersUnderRoot',
- 'devMode': true
- }
- ```
- Surprisingly, with this parameter, the code work. For those new to Apps Script, the development mode only works for the project owner for projects stored in My Drive units and for users having edit access for projects stored in Shared Drives, so this "solution" can't be used on "production".
- After sleeping one night, I tried replacing the script id with the deployment id, without the `devMode` parameter... **Voila! It worked!**.
- So the documentation on the following page looks to be incomplete.
- https://developers.google.com/apps-script/api/reference/rest/v1/scripts/run#path-parameters
- Current content:
- ### Path parameters
- #### Parameters
- <table>
- <tr>
- <td>scriptId</td><td>string</td><td>The script ID of the script to be executed. Find the script ID on the Project settings page under "IDs."</td>
- </tr>
- </table>
- The description should say that the script ID work when using `devMode`, and it's set to `true`. When it's omitted or set to `false`, use the deployment id instead of the script id.
- The deployment id is shown when creating a new deployment. Can be found by opening Google Apps Script, opening the project, and clicking on Deploy > Manage Deployments. The dialog shows the deployment id and a button to copy it to the clipboard.
#2: Post edited
After repeating the procedures, step by step multiple times, I tried adding the devMode parameter and setting it to true. Surprisingly, with this parameter, the code work.After sleeping one night, I decided to try replacing the script id with the deployment id, without the `devMode` parameter... voila! it worked.- So the documentation on the following page looks to be incomplete.
- https://developers.google.com/apps-script/api/reference/rest/v1/scripts/run#path-parameters
- Current content:
- ### Path parameters
- #### Parameters
- <table>
- <tr>
- <td>scriptId</td><td>string</td><td>The script ID of the script to be executed. Find the script ID on the Project settings page under "IDs."</td>
- </tr>
- </table>
The description should say that the script ID work when using devMode and it's set to true. When it's omitted or set to false, use the deployment id instead of the script id.TODO: Add a screenshot
- After repeating the procedures, step by step multiple times, I tried adding the `devMode` parameter to the Apps Script Execution API call and setting it to `true`. This call is in `index.js` file and refers to `gapi.client.script.scripts.run`. The modified call looks as shown below
- ```javascript
- gapi.client.script.scripts.run({
- 'scriptId': scriptId,
- 'resource': {
- 'function': 'getFoldersUnderRoot',
- 'devMode': true
- }
- ```
- Surprisingly, with this parameter, the code work.
- After sleeping one night, I tried replacing the script id with the deployment id, without the `devMode` parameter... **Voila! It worked!**.
- So the documentation on the following page looks to be incomplete.
- https://developers.google.com/apps-script/api/reference/rest/v1/scripts/run#path-parameters
- Current content:
- ### Path parameters
- #### Parameters
- <table>
- <tr>
- <td>scriptId</td><td>string</td><td>The script ID of the script to be executed. Find the script ID on the Project settings page under "IDs."</td>
- </tr>
- </table>
- The description should say that the script ID work when using `devMode`, and it's set to `true`. When it's omitted or set to `false`, use the deployment id instead of the script id.
- The deployment id is shown when creating a new deployment. Can be found by opening Google Apps Script, opening the project, and clicking on Deploy > Manage Deployments. The dialog shows the deployment id and a button to copy it to the clipboard.
#1: Initial revision
After repeating the procedures, step by step multiple times, I tried adding the devMode parameter and setting it to true. Surprisingly, with this parameter, the code work. After sleeping one night, I decided to try replacing the script id with the deployment id, without the `devMode` parameter... voila! it worked. So the documentation on the following page looks to be incomplete. https://developers.google.com/apps-script/api/reference/rest/v1/scripts/run#path-parameters Current content: ### Path parameters #### Parameters <table> <tr> <td>scriptId</td><td>string</td><td>The script ID of the script to be executed. Find the script ID on the Project settings page under "IDs."</td> </tr> </table> The description should say that the script ID work when using devMode and it's set to true. When it's omitted or set to false, use the deployment id instead of the script id. TODO: Add a screenshot