Test and debug JavaScript.

Testing scripts

In order to test functionality, the JavaScript engine can be called manually.

Execute JavaScript

POST /javascript/test

Executes the given JavaScript code.

Accepts:
  • application/javascript , text/plain, text/javascript – The JavaScript code

Produces:
  • application/json – The object returned by the code, in JSON format

Role:

_administrator

JavaScript sessions

See Debugging JavaScript on how to debug JavaScript scripts.

List all JavaScript sessions

GET /javascript/session

Retrieves the the current JavaScript sessions, their current status, and which port they listen to.

Produces:
  • text/plain – A textual list of the current JavaScript sessions in Vidispine, their current status, and which port they listen to

Role:

_administrator

Multiple JavaScript debug sessions cannot share the same port. If several JavaScript sessions are started simultaneously, each is allocate the next free port. The port number can be found using the request above.

Example

POST /javascript/test
Content-Type: application/javascript

1+1
NONE
GET /javascript/session
NONE
0    testscript      STARTED/RUNNING 0.0.0.0/0.0.0.0:59000   null
NONE

Retrieve a JavaScript session

GET /javascript/session/(id)

Retrieves stack trace of a specific JavaScript session.

Produces:
  • text/plain – The stack trace of the session

Status Codes:
  • 400 – The session has no frames

  • 404 – No such session

Role:

_administrator

Example

After having connected to the session:

GET /javascript/session
NONE
0    testscript      CONNECTED/SUSPENDED     0.0.0.0/0.0.0.0:59000   testscript-213efccdd3.js:2
NONE
GET /javascript/session/0
NONE
testscript-213efccdd3.js:2
NONE

Stop a JavaScript session

DELETE /javascript/session/(id)

Stops an active debugging session.

Query Parameters:
  • stop (boolean) –

    • true - Kill the running script.

    • false (default) - Stop the debugging session, and leave the script running.

Status Codes:
  • 400 – If no such session could be found.

Role:

_administrator