Objects

Execute script within context of given object

Changed on

Execute ad-hoc NXSL script provided in the request body within context of given object.

Requires OBJECT_ACCESS_EXECUTE_SCRIPT on the object.

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/objects/{object-id}/execute-script

Request

  • Base URL
    http://127.0.0.1:8000
  • URL
    http://127.0.0.1:8000/v1/objects/{object-id}/execute-script
  • Auth
    HTTP bearer

Path parameters

object-idinteger required

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

resultunknown

Changes