Last date modified: 2025-Jun-17
Import data into RDOs
You can use the Import API to import data programmatically into Relativity Dynamic Objects (RDOs) that already exist in a workspace.
On GitHub, you can find can comprehensive samples illustrating how to import native documents, images, objects, and productions. For additional code samples, see the Import API samples repository.
Create import job
The following code sample illustrates how to create an import job entity in a particular workspace. The job is defined by its unique ID generated by the user and provided in the request.
1
2
3
4
5
6
curl -X POST 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/77140fb9-f515-4b65-a2ce-c347492e2905/'
-H 'X-CSRF-Header: -'
-d '{
"applicationName": "simpleImportRdo",
"correlationID": "rdor31ati0n_ID"
}'
Create import job configuration
The following code sample illustrates how to configure an existing import job by defining sets of significant parameters; import type, mode, and field mappings.
1
2
3
curl -X POST \'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/77140fb9-f515-4b65-a2ce-c347492e2905/rdo-configurations/'
-H 'X-CSRF-Header: -'
-d $"importRdoSettings"'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
"importSettings": {
"OverwriteMode": "Append",
"Fields": {
"FieldMappings": [
{
"ColumnIndex": 0,
"Field": "Name"
},
]
},
"Rdo": {
"ArtifactTypeID": 1000066,
"ParentColumnIndex" :null
},
}
}
1
2
3
4
5
6
7
ImportRdoSettings importSettings = ImportRdoSettingsBuilder.Create()
.WithAppendMode()
.WithFieldsMapped(f => f
.WithField(nameColumnIndex, "Name")
.WithRdo(r => r
.WithArtifactTypeId(domainArtifactTypeID)
.WithoutParentColumnIndex());
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
ImportRdoSettings importSettings = new ImportRdoSettings()
{
Overlay = null,
Fields = new FieldsSettings
{
FieldMappings = new[]
{
new FieldMapping
{
Field = "Name",
ContainsID = false,
ColumnIndex = nameColumnIndex,
ContainsFilePath = false,
},
},
},
Rdo = new RdoSettings
{
ArtifactTypeID = rdoArtifactTypeID,
ParentColumnIndex = null,
},
};
Add data source
The following code sample illustrates how to create data source entities for particular import jobs. It represents the configuration that corresponds to data sets being imported. The data source is identified by its unique ID generated by the user and provided in the request. Data source configuration includes the path to the load file and other significant parameters telling how data in the load file will be read and interpreted by the system.
You can add many data sources to the same import job. Data sources can be added both before a job is started or after. You can add additional sources to running import jobs.
1
2
3
4
5
curl -X POST 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/4c4215bf-d8a3-48d4-a3e0-3a40428415e7/sources/0cb922a2-8df4-42fd-9429-c241410a0002'
-H 'X-CSRF-Header: -' \
-H 'Content-Type: application/json'
-d "$dataSourceSettingsJson"
}'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"dataSourceSettings": {
"Path": "C:\\DefaultFileRepository\\samples\\load_file.dat",
"FirstLineContainsColumnNames": true,
"StartLine": 1,
"ColumnDelimiter": "|",
"QuoteDelimiter": "^",
"NewLineDelimiter": "#",
"MultiValueDelimiter": ";",
"NestedValueDelimiter": "&",
"EndOfLine" = 0
Encoding" = null
"CultureInfo" : "en-US",
"Type": 2
}
}'
1
2
3
4
5
6
7
8
9
10
11
12
13
DataSourceSettings dataSourceSettings = DataSourceSettingsBuilder.Create()
.ForLoadFile("C:\\DefaultFileRepository\\samples\\load_file.dat)
.WithDelimiters(d => d
.WithColumnDelimiters('|')
.WithQuoteDelimiter('^')
.WithNewLineDelimiter('#')
.WithNestedValueDelimiter('&')
.WithMultiValueDelimiter(';'))
.WithFirstLineContainingHeaders()
.WithEndOfLineForWindows()
.WithStartFromBeginning()
.WithDefaultEncoding()
.WithDefaultCultureInfo();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
DataSourceSettings dataSourceSettings = new DataSourceSettings
{
Type = DataSourceType.LoadFile,
Path = "C:\\DefaultFileRepository\\samples\\load_file.dat",
NewLineDelimiter = '#',
ColumnDelimiter = '|',
QuoteDelimiter = '^',
MultiValueDelimiter = ';',
NestedValueDelimiter = '&',
Encoding = null,
CultureInfo = "en-us",
EndOfLine = DataSourceEndOfLine.Windows,
FirstLineContainsColumnNames = true,
StartLine = 0,
};
Begin import job
The following code sample illustrates how to start an import job using begin. Begin allows you to schedule importing data to a workspace. A begun job does not mean that data is instantly imported. However, data sources are added to the queue and scheduled. The import job state or data source state shows the current stage of the import job.
1
2
3
curl -X POST 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/77140fb9-f515-4b65-a2ce-c347492e2905/begin/'
-H 'X-CSRF-Header: -'
-d ''
End import job
The following code sample illustrates how to end an import job that has already started. It is highly recommended to add the code if no more data sources are planned to be added. All data sources added to the job before the end request is sent will be imported.