Skip to end of metadata
Go to start of metadata

Writing Scripts

Scripts are written in JavaScript which can be executed on the server via the RunScript API or offline via triggered scripts. They have full access to the Apstrata apis and provide the developer the ability to add more complex validation rules and business logic before persisting data to the server. Scripts also provide a way for the developer to orchestrate multiple API calls, passing data from one call to the other. Each script has its own global scope which is deallocated after the RunScript completes. Helper objects are available by default in the script’s global scope to allow the developer to communicate with apstrata database server and its services. The following is the list of objects that are available in each script’s scope, and which are described in more details later in this section.

  • request - gives access to the HTTP request components, including parameters, headers and the request user
  • apsdb - entry point for calling apstrata APIs, managing transactions and manipulating the http response
  • log - utility object for creating log traces to the HTTP response. In an upcoming release, logs will be downloadable via a dedicated REST API


For specific details on creating a script, please check the SaveScript API.

For specific details on running a script, please check the RunScript API.


  • No labels