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:
- Copy the content of sample dataset to your Relativity fileshare.
-
Uncomment the line with sample invocation you want to run in Main method.
Copy1 2 3 4
// await sampleCollection.Sample08_ImportImages();
// await sampleCollection.Sample09_ImportProductionFiles();
await sampleCollection.Sample10_ImportImagesInAppendOverlayMode(); -
Set the proper credentials and URI of your Relativity instance in RelativityUserSettings helper class.
Copy1 2 3 4 5 6 7 8
public class RelativityUserSettings
{
public const string BaseAddress = "https://host/Relativity.REST/";
public const string UserName = "sample.user@test.com";
public const string Password = "password!";
} -
Update workspaceId const to the proper value equals Id of the workspace where you intend to import data. It is required in each sample.
Copy1 2
// destination workspace artifact Id.
const int workspaceId = 1000000; - Update other Ids related to your workspace (productionSetsArtifactId and rootFolderId,rdoArtifactTypeID). They are required only by specific samples.
-
Update const which defines the path to the load file (e.g. const string loadFile01Path) according to the location where you copied sample data.
Copy1 2
// Path to the file in opticon format used in data source settings.
const string opticonFilePath = "\\files\\T001\\Files\\SampleDataSources\\opticon_01.opt"; - Run the application.
KeplerClient Code Samples
To run a sample code, complete the following steps:
- Copy the content of sample dataset to your Relativity fileshare.
- Uncomment the line with sample invocation you want to run in Main method.
-
Set the proper credentials and host address of your Relativity instance in RelativityUserSettings helper class.
Copy1 2 3 4 5 6 7 8
public static class RelativityUserSettings
{
public const string HostAddress = "https://host-address";
public const string UserName = "sample.user@test.com";
public const string Password = "password!";
} - Update workspaceId const to the proper value equal Id of the workspace where you intend to import data. It is required in each sample.
- Update other Ids related to your workspace (productionSetsArtifactId and rootFolderId,rdoArtifactTypeID). They are required only by specific samples.
- Update const which defines the path to the load file (e.g. const string loadFile01Path) according to the location where you copied sample data.
- Run the application.
Powershell Script Samples
To run a sample code, complete the following steps:
-
Install Powershell Pester Module (ver. >= 5.3.3)
Copy1
Find-Module -Name "Pester" | Install-Module -Force; - Copy the content of sample dataset to your Relativity fileshare.
-
Uncomment line with sample invocation you want to run in run-sample-import.ps1.
Copy1 2 3 4
Describe "Sample import" {
. "$global:rootDir\SamplesCollection\sample01-import-native-files.ps1"
# . "$global:rootDir\SamplesCollection\sample02-import-documents-in-overlay-mode.ps1" -
Set the proper credentials and host address of your Relativity instance in run-sample-import.ps1.
Copy1 2 3
$hostAddress = "https://sample-host/"
$userName = "sample@username"
$password = "password!" - Update workspaceId to the proper value equal Id of the workspace where you intend to import data. It is required in each sample.
-
Update variable which defines the path to the load file/opticon file (e.g. $opticonFilePath) according to the location where you copied sample data.
Copy1 2
$workspaceId = 1000000
$loadFilePath = "\\files\T001\Files\SampleDataSources\load_file_01.dat" - Update other Ids related to your workspace (productionSetsArtifactId and rootFolderId,rdoArtifactTypeID). They are required only by specific samples.
- Invoke run-sample-import.ps1.