Scripting app
Introduction
This topic provides you with general information about the scripting API.
Scripting app scope of functions
The scripting app lets you create, edit and execute scripts.
See also:
- Starting a script
- Starting a script which runs in the background
- Querying all script logs
- Querying the contents of a specific log
Starting a script
You can use this HTTP interface to execute scripts.
- URI: /scripting/script/{scriptId}/run
- Methods: POST, GET, PUT, DELETE, PATCH
The script executions are limited to 10 simultaneous executions per tenant.
Request
You have the option to call the interface with any body in order to evaluate the body in the script. All content types are supported (application/json, text/plain etc.).
POST, GET, PUT, DELETE, PATCH /scripting/script/{scriptId}/run
{
"name": "John Smith"
}
Response
The content and content type depend on the response of the script.
Return values
- Custom: The status is set individually by the executed script.
- 401: The user is not authenticated.
- 404: The script does not exist.
- 429: The limit of 10 simultaneous executions was exceeded.
- 500: Could not start script.
- 502: Could not fully execute script.
- 504: The script was stopped because of a timeout.
Starting a script in the background
You can use this HTTP interface to execute scripts in the background.
Asynchronous script executions are limited to a total of 100 simultaneous executions. This limitation ensures the synchronous script execution.
- URI: /scripting/script/{scriptId}/background
- Methods: POST, GET, PUT, DELETE, PATCH
Request
You have the option to call the interface with any body in order to evaluate the body in the script. All content types are supported (application/json, text/plain etc.).
POST, GET, PUT, DELETE, PATCH /scripting/script/{scriptId}/background
{
"name": "John Smith"
}
Response
The response only informs you whether the script could be scheduled successfully. The script itself does not answer. If you want to know whether the script could be started successfully, you can adjust the configuration of your script accordingly. For example, you can code that the script sends the status via URL to the corresponding app.
The maximum runtime of background scripts is limited to 14 minutes. The maximum header size of a request is 256kb.
Return values
- 202: The script was scheduled successfully and will be started shortly.
- 401: The user is not authenticated.
- 404: The script does not exist.
- 500: The script could not be scheduled.
Querying all script logs
You can query a list with all logs of the latest script version.
- URI: /scripting/log/script/{scriptId}
- Method: GET
Response
{
"filteredLogs": [
{
"executionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"scriptId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"executionDate": "2022-11-11T07:09:35Z",
"statusCode": 200,
}
],
"moreElements": false
}
Return values
- 200: The request was successful.
- 401: The user is not authenticated.
- 403: The user is not allowed to query logs for this script.
- 404: The script does not exist.
- 500: Server error.
Querying the contents of a specific log
You can use this HTTP interface to query the contents of script execution logs.
- URI: /scripting/log/script/{scriptId}/execution/{executionId}
- Method: GET
Response
The content and content type depend on the response of the script.
GET /scripting/log/script/{scriptId}/execution/{executionId}
Hello John Smith!
Return values
- 200: The request was successful.
- 401: The user is not authenticated.
- 403: The user is not allowed to query logs for this script.
- 404: The script does not exist.
- 500: Server error.