Script Library

Execute script without object context

Execute ad-hoc NXSL script provided in the request body without object context ($object and $node are not set). Script runs with access rights of the calling user.

Requires SYSTEM_ACCESS_MANAGE_SCRIPTS.

By default the script is executed synchronously and only its return value is provided. When stream is true, the script is compiled synchronously (compilation errors are still reported with status 400), then the server returns 202 with a single-use token. The script starts once the client connects to the WebSocket URL from the response; script output (print, println, trace) and the final result are delivered over that connection. See GET /v1/script-executions/output/{token}. A running script can be stopped with POST /v1/script-executions/{execution-id}/stop or by sending {"type":"stop"} over the WebSocket.

post/v1/execute-script

Request body

parametersstring[]

Optional list of parameters to be passed to the script

resultAsMapboolean

If true, result will always be presented as a map (JSON object)

scriptstring required

Source code of the script

streamboolean

If true, execute script asynchronously and stream its output via WebSocket

Response

Script executed successfully

{"stackTrail":"components:schemas:ScriptExecutionResult:properties:result","oasType":"schema","type":"unknown","description":"Script result. When resultAsMap is true (or the script returns a hash map or array) this is a JSON object; otherwise the scalar result serialized as JSON."}

Changes

Changed in 1 of the 128 revisions of this API.1