As part of the Relativity Services API (RSAPI) Deprecation, content on this page referring to the RSAPI and the Patient Tracker application is in the process of being deprecated and will no longer be supported. For more information and alternative APIs, see RSAPI deprecation process.

Use the Application Deployment System through the Services API

The Application Deployment System (ADS) provides functionality that you can use to work with your custom applications through the Relativity UI. You can also use the Services API to perform several of these ADS operations programmatically. The RSAPIClient class includes methods for installing and exporting applications, as well as for adding resource files with your custom code to Relativity.

This page contains the following information:

Install an application

You can use the InstallApplication() method on the RSAPIClient class to programmatically import an application into a Relativity workspace. Note that an application can be installed from a RAP file as a new application or replace a set of one or more already installed applications. If the new application replaces existing applications, these applications must be specified in the appsToOverride list. The applications also must be unlocked. For new application installations, the appsToOverride parameter can be ignored. For more information, see Installing applications on the Relativity Server 2022 Documentation site.

Copy

public static void ImportApplication(IRSAPIClient proxy)
{
     proxy.APIOptions.WorkspaceID = 1000001; //set the target workspace of application to be imported.
      
     // Create an application install request. 
     // This list contains the ArtifactID for each Relativity Application that you want to install.
     List<int> appsToOverride = new List<int>();
      
     // Set the forceFlag to true. The forceFlag unlocks any applications in the workspace 
     // that conflict with the application that you are loading. The applications must be unlocked 
     // for the install operation to succeed.
     bool forceFlag = true;
     AppInstallRequest appInstallRequest = new AppInstallRequest(appsToOverride, forceFlag);
      
     // Set the file path of the application that you want to import.
     appInstallRequest.FullFilePath = System.IO.Path.GetFileName("<PathToFile>");
     try
     {
          proxy.InstallApplication(proxy.APIOptions, appInstallRequest);
     }
     catch (System.Exception)
     {
          // Handle exceptions. The client closes automatically.
     }
}

Export an application

Using the ExportApplication() method, you export applications as RAP files. For more information, see Exporting applications on the Relativity Server 2022 Documentation site.

Copy

public static void ExportApplication(IRSAPIClient proxy)
{
     proxy.APIOptions.WorkspaceID = 1000001;
      
     // Create a AppExportRequst.
      
     AppExportRequest appExportReq = new AppExportRequest(1000002 /*Application ArtifactID*/, "C:\\MyApplication.rap");
      
     try
     {
          proxy.ExportApplication(proxy.APIOptions, appExportReq);
     }
     catch (System.Exception)
     {
          // Handle exceptions. The client closes automatically.
     }
}

Upload custom files or assemblies

While you can upload most file types, certain types are restricted including executable files (.exe), COM files (.com), and others. For more information, see Resource files on the Relativity Server 2022 Documentation site.

Note: You can update a custom page by calling the Update() method on a File field on an Relativity Dynamic Object (RDO). For more information, see RDO.

Copy

public static void PushAResourceFile(IRSAPIClient proxy)
{
     proxy.APIOptions.WorkspaceID = -1;
      
     // Create a UploadCustomPageRequest.
     ResourceFileRequest rfRequest = new ResourceFileRequest();
      
     // Replace  <PathToFile> with your file path. If the file exists in Relativity, then it is updated. 
     // Otherwise, it is created in Relativity.
     rfRequest.FullFilePath = "<PathToFile>";
      
     // Replace with your application GUID.
     rfRequest.AppGuid = new System.Guid("<APPLICATION_GUID>");
      
     // Specify a PathToFile or a constant value.
     rfRequest.FileName = System.IO.Path.GetFileName("<PathToFile>");
      
     try
     {
          proxy.PushResourceFiles(proxy.APIOptions, new System.Collections.Generic.List<ResourceFileRequest>() {rfRequest});
     }
     catch (System.Exception)
     {
          // Handle exceptions. The client closes automatically.
     }
}