You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/sigmaguides/src/developers_api_code_samples/developers_api_code_samples.md
+46-2Lines changed: 46 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -200,7 +200,6 @@ It also exports a Javascript function to request a bearer token (token) each tim
200
200
<asideclass="positive">
201
201
<strong>IMPORTANT:</strong><br> The token is valid for 3599 seconds (just under one hour) and needs to be refreshed. Our Javascript function will handle that.
202
202
</aside>
203
-
`
204
203
In the project root directory, open the file `get-access-token.js` and review it's contents. Each section is commented so it can be understood.
205
204
206
205
Start the VSCode debugger against this code by pressing `F5` on your keyboard.
@@ -1166,7 +1165,7 @@ Duration: 20
1166
1165
1167
1166
A common use case is to programmatically initiate an existing materialization job in Sigma, via API.
1168
1167
1169
-
This section demonstrates the code that was provided on the `API Code Samples` > `Workbook: Workbook: Initiate Materialization Job` page, [located here.](https://help.sigmacomputing.com/recipes/workbook-initiate-materialization-job)
1168
+
This section demonstrates the code that was provided on the `API Code Samples` > `Workbook: Initiate Materialization Job` page, [located here.](https://help.sigmacomputing.com/recipes/workbook-initiate-materialization-job)
1170
1169
1171
1170
<asideclass="positive">
1172
1171
<strong>IMPORTANT:</strong><br> This script will call the get-access-token > getBearerToken function to get a new/refreshed token automatically so there is no need to do anything else, assuming you have completed the section of this QuickStart "Authentication - REQUIRED" and ensured your .env file is configured correctly.
@@ -1346,6 +1345,51 @@ The expected response is:
1346
1345

1347
1346
<!-- END OF SECTION-->
1348
1347
1348
+
## Workbook: Reassign Ownership by Email
1349
+
Duration: 20
1350
+
1351
+
A common use case is to programmatically reassign workbook ownership based on email addresses in Sigma, via API.
1352
+
1353
+
This section demonstrates the code that was provided on the `API Code Samples` > `Workbook: Reassign Ownership by Email` page, [located here.](https://help.sigmacomputing.com/recipes/Reassign-Ownership-by-Email)
1354
+
1355
+
<asideclass="positive">
1356
+
<strong>IMPORTANT:</strong><br> This script will call the get-access-token > getBearerToken function to get a new/refreshed token automatically so there is no need to do anything else, assuming you have completed the section of this QuickStart "Authentication - REQUIRED" and ensured your .env file is configured correctly.
1357
+
</aside>
1358
+
1359
+
### Description
1360
+
This recipe will change the owner of all workbooks owned by the email address in the `OLD_OWNER_EMAIL` parameter in the .env file.
1361
+
1362
+
The new owner will be the email based on the `NEW_OWNER_EMAIL` parameter.
1363
+
1364
+
### Running the Script
1365
+
Open the file `transfer-all-workbooks.js` in the `workbooks` folder:
1366
+
1367
+
Each code block is commented to explain what operations are being performed.
1368
+
1369
+
In the `.env` file there are two additional required parameters, one for the current owner and one for the new:
1370
+
```code
1371
+
OLD_OWNER_EMAIL=
1372
+
NEW_OWNER_EMAIL=
1373
+
```
1374
+
1375
+
<asideclass="positive">
1376
+
<strong>IMPORTANT:</strong><br> Take care running this script as ALL WORKBOOKS assigned to the OLD_OWNER_EMAIL will be reassigned!
1377
+
1378
+
Both emails need to exist in Sigma.
1379
+
</aside>
1380
+
1381
+
Press `F5` to run the script with VSCode's debugger.
1382
+
1383
+
The expected response is:
1384
+
1385
+
<imgsrc="assets/apics74.png"width="800"/>
1386
+
1387
+
Verify the workbooks are assigned to the new owner by looking at the Sigma portal and locating a few of the workbooks listed in Sigma.
0 commit comments