- URL:
- https://<root>/notebooks/executeNotebook
- Methods:
POST- Version Introduced:
- 11.4
Access requirements
Required privileges
The Enterprise Administrator API requires privilege-based access. An administrator must be assigned a specific user privilege, or role, to access any given endpoint. Listed below are the user privileges or roles an administrator can be assigned that provides access to this endpoint. If multiple privileges are listed, only one needs to be assigned to gain access.
To access notebook-related endpoints, administrators must be assigned a custom role that includes any of the privileges listed above as well as the Create and edit notebooks privilege.
Tokens
This API requires token-based authentication. A token is automatically generated for administrators who sign in to the Enterprise Administrator API directory's HTML interface. Tokens generated in this way are stored for the entirety of the session.
Those accessing the API directory outside of the HTML interface will need to acquire a session token from the generate operation in the Enterprise Directory API. For security reasons, all POST requests made to the Enterprise Administrator API must include a token in the request body.
Description
The execute operation allows administrators and users with Create and Edit ArcGIS Notebooks privileges to automate running a notebook. The notebook specified in the operation is run with all cells in order. Using this operation and an external scheduling tool, you can schedule a notebook to run automatically either once or as a regular occurrence. This allows you to automate repeating tasks such as data collection and cleaning, content updates, and portal administration.
You can specify parameters to be used in the notebook when it's run. If you specify one or more parameters, they are inserted into the notebook as a new cell. This cell is placed at the beginning of the notebook, unless you added the parameters tag to a cell.
Request parameters
| Parameter | Details |
|---|---|
| The portal item ID of the notebook you want to execute. You can find this value in the Notebook resource in this directory or in the portal as part of the item details page URL. Ensure that the notebook is using a runtime that's compatible with your software version. Example: |
| Specifies whether the notebook portal item is updated after execution. The default is Values: |
| Optional parameters in JSON format that will be added to the notebook for this execution. The parameters are inserted as a new cell directly after the cell you tagged as parameters . The following data types are supported for task parameters: string, long, Boolean, date, feature set, and record set. Example: |
| Specifies whether the Values: |
| The response format. The default response format is Values: |
Response properties
| Property | Details |
|---|---|
| Indicates whether the operation succeeded in executing the notebook. |
| A unique Job Id representing the asynchronous |
| The maximum number of snapshots allowed for a notebook. The default value is 5. |
| Job url to monitor the status of |
Example usage
The following is a sample POST request for the execute operation:
POST /<context>/admin/notebooks/executeNotebook HTTP/1.1
Host: organization.example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: [ ]
itemId=70770e46d4be426dbd3adbec5f9124c8&updatePortalItem=true¬ebookParameters={"name": "somename", "population": 19927500, "pop_percent": 11.94, "lowest_elevation_ft": -220, "highest_elevation": 12486, "top5cities": ["City 1", "City 2", "City 3", "City 4", "City 5"], "top5Values": [ 100, 98.2, 93.3, 89, 74], "isTrue": false, "value": null, "access": { "allowed": true}}&saveInjectedParameters=false&f=pjson&token=[token]JSON Response example
{
"jobId": "j3a581ce0-cf2f-4190-96a5-c5bc0617dd5d",
"jobUrl": " https://organization.example.com/<context>/admin/jobs/j3a581ce0-cf2f-4190-96a5-c5bc0617dd5d",
"status": "success"
}