Last date modified: 2026-Feb-06

Samples types and structure

There are three types of sample applications that demonstrate the use of Import Service API features:

  • .Net7ConsoleClient - .NET console application (.NET 7, C#).
  • KeplerClientConsole - .NET console application (.NET Framework 4.6.2, Kepler client, C#).
  • REST client - Powershell scripts.

Samples follow the following structure:

  • Each code example for a particular import flow is contained in a separate file (e.g. Sample04_AddDataSourceToRunningJob.cs).
  • Each sample is numbered. The number of the sample is included in the file and class name.
  • The individual samples for each application are consistent. For instance Sample_08 in Net7ConsoleClient presents the same import flow as in KeplerClientConsole and in PS scripts.
  • Sample code contains accurate comments describing the flow.
  • Expected console result of demonstrated sample flow is included at the end of the file.
  • Repositories with samples also contain structured data sets used in all examples; load files, opticon files, folders structure with native files, images, and text files.

List of samples:

Sample name .Net with Kepler .NET 7 PowerShell
Sample01_ImportNativeFiles Sample01 Sample01 Sample01
Sample02_ImportDocumentsInOverlayMode Sample02 Sample02 Sample02
Sample03_ImportFromTwoDataSources Sample03 Sample03 Sample03
Sample04_AddDataSourceToRunningJob Sample04 Sample04 Sample04
Sample05_ImportDocumentsWithExtractedText Sample05 Sample05 Sample05
Sample06_ImportDocumentsToSelectedFolder Sample06 Sample06 Sample06
Sample07_DirectImportSettingsForDocuments.cs Sample07 Sample07 Sample07
Sample08_ImportImages Sample08 Sample08 Sample08
Sample09_ImportProductionFiles Sample09 Sample09 Sample09
Sample10_ImportImagesInAppendOverlayMode Sample10 Sample10 Sample10
Sample11_DirectImportSettingsForImages Sample11 Sample11 Sample11
Sample12_ImportRelativityDynamicObject Sample12 Sample12 Sample12
Sample13_ImportRdoWithParent Sample13 Sample13 Sample13
Sample14_DirectImportSettingsForRdo Sample14 Sample14 Sample14
Sample15_ReadImportRdoSettings Sample15 Sample15 Sample15
Sample16_ReadImportDocumentSettings Sample16 Sample16 Sample16
Sample17_GetImportJobs Sample17 Sample17 Sample17
Sample18_GetDataSource Sample18 Sample18 Sample18
Sample19_GetImportJobDetailsAndProgress Sample19 Sample19 Sample19
Sample20_GetDataSourceDetailsAndProgress Sample20 Sample20 Sample20
Sample21_CancelStartedJob Sample21 Sample21 Sample21
Sample22_ReadResponse Sample22 Sample22 Sample22
Sample23_GetDataSourceErrors Sample23 Sample23 Sample23

.NET 7 Code Samples

To run a sample code, complete the following steps:

  1. Copy the content of sample dataset to your Relativity fileshare.
  2. Uncomment the line with sample invocation you want to run in Main method.

    Copy
    // await sampleCollection.Sample08_ImportImages();
         // await sampleCollection.Sample09_ImportProductionFiles();

         await sampleCollection.Sample10_ImportImagesInAppendOverlayMode();                  
  3. Set the proper credentials and URI of your Relativity instance in RelativityUserSettings helper class.

    Copy
    public class RelativityUserSettings
     {
         public const string BaseAddress = "https://host/Relativity.REST/";

         public const string UserName = "sample.user@test.com";

         public const string Password = "password!";
     }
  4. Update workspaceId const to the proper value equals Id of the workspace where you intend to import data. It is required in each sample.

    Copy
    // destination workspace artifact Id.
     const int workspaceId = 1000000;        
  5. Update other Ids related to your workspace (productionSetsArtifactId and rootFolderId,rdoArtifactTypeID). They are required only by specific samples.
  6. Update const which defines the path to the load file (e.g. const string loadFile01Path) according to the location where you copied sample data.

    Copy
    // Path to the file in opticon format used in data source settings.
         const string opticonFilePath = "\\files\\T001\\Files\\SampleDataSources\\opticon_01.opt";
  7. Run the application.

KeplerClient Code Samples

To run a sample code, complete the following steps:

  1. Copy the content of sample dataset to your Relativity fileshare.
  2. Uncomment the line with sample invocation you want to run in Main method.
  3. Set the proper credentials and host address of your Relativity instance in RelativityUserSettings helper class.

    Copy
    public static class RelativityUserSettings
     {
     public const string HostAddress = "https://host-address";

     public const string UserName = "sample.user@test.com";

     public const string Password = "password!";
     }
  4. Update workspaceId const to the proper value equal Id of the workspace where you intend to import data. It is required in each sample.
  5. Update other Ids related to your workspace (productionSetsArtifactId and rootFolderId,rdoArtifactTypeID). They are required only by specific samples.
  6. Update const which defines the path to the load file (e.g. const string loadFile01Path) according to the location where you copied sample data.
  7. Run the application.

Powershell Script Samples

To run a sample code, complete the following steps:

  1. Install Powershell Pester Module (ver. >= 5.3.3)

    Copy
    Find-Module -Name "Pester" | Install-Module -Force;          
  2. Copy the content of sample dataset to your Relativity fileshare.
  3. Uncomment line with sample invocation you want to run in run-sample-import.ps1.

    Copy
    Describe "Sample import" {
      . "$global:rootDir\SamplesCollection\sample01-import-native-files.ps1"

      # . "$global:rootDir\SamplesCollection\sample02-import-documents-in-overlay-mode.ps1"
  4. Set the proper credentials and host address of your Relativity instance in run-sample-import.ps1.

    Copy
    $hostAddress = "https://sample-host/"
     $userName = "sample@username"
     $password = "password!"
  5. Update workspaceId to the proper value equal Id of the workspace where you intend to import data. It is required in each sample.
  6. Update variable which defines the path to the load file/opticon file (e.g. $opticonFilePath) according to the location where you copied sample data.

    Copy
      $workspaceId = 1000000
      $loadFilePath = "\\files\T001\Files\SampleDataSources\load_file_01.dat"
  7. Update other Ids related to your workspace (productionSetsArtifactId and rootFolderId,rdoArtifactTypeID). They are required only by specific samples.
  8. Invoke run-sample-import.ps1.
Return to top of the page
Feedback