Script Manager (REST)

In Relativity, you can execute SQL scripts through the UI that act on the databases backing an instance. You can implement these scripts to customize and extend Relativity functionality. For more information, see Scripts on the RelativityOne Documentation site.

Note: If you use a Relativity script in a custom development project, it is recommended to make a copy of the script and use the copied script in your project. Software updates may modify the scripts provided by Relativity, which could cause unintended results if you use the Relativity-provided scripts directly in your custom development projects.

The Relativity Script Manager API service exposes endpoints for interacting with scripts as follows:

  • Using CRUD operations on a script
  • Retrieving script input parameters
  • Previewing a script and its input parameters
  • Importing a scripting
  • Running jobs on a script, such as retrieving its status, exporting results, and others.

Use this service to create standalone applications that manage scripts across multiple environments or across workspaces in a single environment.

You can also use the Script service through .NET. For more information, see Script Manager API.

Postman sample file

You can use the Postman sample file to become familiar with making calls to endpoints on the Script Manager service. To download the sample file, click Script Manager Postman file.

To get started with Postman, complete these steps:

  1. Obtain access to a Relativity environment. You need a username and password to make calls to your environment.
  2. Install Postman.
  3. Import the Postman sample file for the service. For more information, see Working with data files on the Postman web site.
  4. Select an endpoint. Update the URL with the domain for your Relativity environment and any other variables.
  5. In the Authorization tab, set the Type to Basic Auth, enter your Relativity credentials, and click Update Request.
  6. See the following sections on this page for more information on setting required fields for a request.
  7. Click Send to make a request.

Guidelines for the Script Manager service

Review the following guidelines for working with this service.

URLs

The URLs for REST endpoints contain path parameters that you need to set before making a call:

  • Set the {versionNumber} placeholder to the version of the REST API that you want to use, using the format lowercase v and the version number, for example v1.
  • Set other path parameters in the URLs to the Artifact ID of a given entity, for example setting {workspaceID} to the Artifact ID of a workspace.
  • Note: To indicate the admin-level context, set the {workspaceID} path parameter to -1.

For example, you can use the following URL to update a script:

Copy
<host>/Relativity.Rest/api/relativity-extensibility/{versionNumber}/workspaces/{workspaceID}/scripts/{scriptID}

Set the path parameters as follows:

  • {versionNumber} to the version of the API, such as v1.
  • {workspaceID} to the Artifact ID of the workspace that contains the script.
  • {scriptID} to the Artifact ID of a script.

Client code sample

To use the Script Manager service, send requests by making calls with the required HTTP methods. You can use the following .NET code as a sample client for creating a script.

Create a script

Read a script

Update a script

Delete a script

Import a script

Get script parameters

Preview a script body and input values

Run script jobs and reports

This section contains endpoints and JSON samples that illustrate how to run jobs, query for results, export results, and clean up script jobs.

Note: You should call the CleanupRunJobAsync method once querying the results of your script job has finished.

Enqueue run job

Read run job

Query action job results

Export action results

Export script report

Clean up run job