{"id":37483051,"url":"https://github.com/relativitydev/relativity-import-samples","last_synced_at":"2026-01-16T07:28:56.678Z","repository":{"id":76243270,"uuid":"523626098","full_name":"relativitydev/relativity-import-samples","owner":"relativitydev","description":"Repository provides useful samples how Relativity Import API can be utilized.","archived":false,"fork":false,"pushed_at":"2024-09-10T12:56:49.000Z","size":773,"stargazers_count":6,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-28T12:26:24.673Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/relativitydev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-11T07:27:54.000Z","updated_at":"2024-09-10T12:59:42.000Z","dependencies_parsed_at":"2024-08-20T10:19:45.056Z","dependency_job_id":null,"html_url":"https://github.com/relativitydev/relativity-import-samples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/relativitydev/relativity-import-samples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relativitydev%2Frelativity-import-samples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relativitydev%2Frelativity-import-samples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relativitydev%2Frelativity-import-samples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relativitydev%2Frelativity-import-samples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/relativitydev","download_url":"https://codeload.github.com/relativitydev/relativity-import-samples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relativitydev%2Frelativity-import-samples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-16T07:28:55.798Z","updated_at":"2026-01-16T07:28:56.651Z","avatar_url":"https://github.com/relativitydev.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# relativity-import\n\n### Table of Contents\n### **[Introduction](#introduction)**\n**[Prerequisites](#prerequisites)**\u003cbr\u003e\n**[Glossary](#glossary)**\u003cbr\u003e\n### **[Getting Started](#getting-started-1)**\n**[NuGet Libraries](#relativityimportsdk)**\u003cbr\u003e\n**[Authorization](#authorization)**\u003cbr\u003e\n**[Permissions](#permissions)**\u003cbr\u003e\n**[Builders](#builders)**\u003cbr\u003e\n**[General Import flow description ](#general-import-flow-description)**\u003cbr\u003e\n**[Example Import flows](#example-of-simple-import-documents-flow)**\u003cbr\u003e\n**[API Documentation](#rest-api)**\u003cbr\u003e\n**[API Response](#api-response)**\u003cbr\u003e\n**[ImportJob \u0026 DataSource States](#rest-api)**\u003cbr\u003e\n**[Errors](#errors)**\u003cbr\u003e\n### **[Code Samples](#samples)**\n**[.NET Console Application - How-to](#net-code-samples---how-to)**\u003cbr\u003e\n**[.NET Framework \u0026 Kepler Console Application - How-to](#keplerclient-code-samples---how-to)**\u003cbr\u003e\n**[Powershell scripts - How-to](#powershell-script-samples---how-to)**\u003cbr\u003e\n### **[Performance Best Practices](#performance-best-practices)**\n**[Import Job Settings](#import-job-settings)**\u003cbr\u003e\n\n\n\n# Introduction\nThe ***Relativity Import Service API***  is a Kepler service that provides functionality for importing large numbers of documents, images, and Relativity Dynamic Objects (RDOs) into a Relativity workspace. \nThe import process operates on structured data sets that are described by load file and located in a place accessible for workspace.  \nThe main principle of operation is based on creating managed importing job with a list of data sets (intended for import) assigned to it.\n\u003cbr\u003e\n\nThanks to RESTful API you are able to easily create import job, configure it and run it. \nDataset (containing structured data) that you want to import can be then added as a source to the job. The system will take care of it in the background by adding this source to the queue, scheduling and finally starting the import data to destination workspace, and if necessary, resuming the import process. All that remains for the user is to monitor the status of import and current progress - all using  provided API.\n\nJob and data sources configurations allow you to flexibly adjust the import to your needs. In addition, the adopted error handling helps you to identify the source of potential problems. \n\n NOTE: Import Service (*Import*) is delivered as a RAP application installed in Relativity One.\n\n# Prerequisites\n\n1. The following Relativity applications must be installed:\n\n\n\n    | application name     | application Guid                      | where installed     |\n    |----------------------|---------------------------------------|---------------------|\n    |*Import*              | 21F65FDC-3016-4F2B-9698-DE151A6186A2  |  workspace          |\n    |*DataTransfer.Legacy* | 9f9d45ff-5dcd-462d-996d-b9033ea8cfce  |  instance           |\n\n\n2. Appropriate user [permissions](#permissions) need to be set. \n\n\n3. Data set - load files, source files (native documents, images, text files) - need to be placed in the destination fileshare location accessible to workspace. \n   You can use TAPI (https://platform.relativity.com/RelativityOne/#Transfer_API/Relativity_Transfer_SDK.htm) to upload all files to destination location.\n\n4. The following packages need to be installed in client application:\n   *NOTE*: Required only when Kepler .NET client is used.\n   - [Relativity.Import.SDK](#relativityimportsdk)\n   - [Relativity.Import.Models.SDK](#relativityimportsdk) (added automatically as dependency to Relativity.Import.SDK)\n   - [Relativity.Kepler.Client.SDK](https://www.nuget.org/packages/Relativity.Kepler.Client.SDK)\n   (added automatically as dependency to Relativity.Import.SDK)\n\n\n***\n## Glossary\n\n**Data importing** - Functionality that makes that structured data set are uploaded into destination workspace.\n\n**Dataset** - Structured data containing metadata, native documents, images, text files described by load file or opticon file.\nSuch a dataset can be pointed during data source configuration and MUST be located in place accessible for workspace. \n\n**ImportJob** - It is the main object in import service taking part in import flow. It represents single import entity described by its configuration which decides about import behavior e.g. import type, overlay mode, fields mapping, etc.  \nIn addition, ImportJob object holds the information about its current state and import progress.\nImport jobs aggregates dataSources - single import job can consists of many sources.\n\n**DataSource**  - It is an object that corresponds to single set of data to be imported. Each data source has own configuration that indicates the physical location of data set (load file). Data set configuration affects also how data in load file are read.\nIn addition, data source stores the information about current state and import progress of particular source.\n\n**Kepler service** - API service created but using the Relativity Kepler framework. This framework provides you with the ability to build custom REST Endpoints via a .NET interface. Additionally, the Kepler framework includes a client proxy that you can use when interacting with the services through .NET. [See more information](https://platform.relativity.com/RelativityOne/index.htm#Kepler_framework/Kepler_framework.htm#Client-s)\n\n**Item Error** - An error that may occur during the import process and concerns only one imported record from the load file. A common reason of these errors are data validation or already existing records in the workspace.\n\n---\n# Getting Started\nImport Service is built as a standard Relativity Kepler Service. It provides sets of endpoints that must be called sequentially in order to execute import.\nThe following sections outline how to make calls to import service.\n    \n\u003e HTTP clients \n\n You can make calls to a import service using any standard REST or HTTP client, because all APIs (Keplers APIs) are exposed over the HTTP protocol. You need to set the required X-CSRF-Header. [more details](https://platform.relativity.com/RelativityOne/index.htm#Kepler_framework/Kepler_framework.htm#Client-s) \n\n        HttpClient client = new HttpClient();\n        client.DefaultRequestHeaders.Add(\"X-CSRF-Header\", \"-\");\n\n        createImportJobUri = $\"{host}/Relativity.REST/api/import.service/v1....\n        \n        var response = await httpClient.PostAsJsonAsync(createImportJobUri, payload);\n\nIn case of using .NET client the [Relativity.Import.Models.SDK](#relativityimportmodelssdk) package containing contract models would be used.\n\n  Please look at dedicated [code samples](#samples) for .NET 7 or for PowerShell scripts.\n\n\u003e Kepler .NET client\n\nYou can access Kepler service from any .NET language using the client library provided as part of the Kepler framework. It exposes a factory class that you can use to create the client proxy by passing URIs to import services and credentials. Then use .NET proxy to interact with a import service as a set of .NET objects. When you call a member method, the proxy makes a corresponding HTTP request to the respective service endpoint. [more details](https://platform.relativity.com/RelativityOne/index.htm#Kepler_framework/Kepler_framework.htm#Client-s) \n\nKepler contract for import service are exposed in [Relativity.Import.SDK](relativityimportsdk) package.\n\n\n        using (Relativity.Import.V1.Services.IImportJobController importJobController =_serviceFactory.CreateProxy\u003cRelativity.Import.V1.Services.IImportJobController\u003e())\n        {\n            // Create import job.\n            Response response = await importJobController.CreateAsync(\n                importJobID: importId,\n                workspaceID: workspaceId,\n                applicationName: \"Import-service-sample-app\",\n                correlationID: \"Sample-job-0001\");\n            }\n        }\n\n  Please look at dedicated [code samples](#samples) for .NET 4.6.2 with Kepler.\n\n---\n## Relativity.Import.SDK ###\n\nRelativity.Import.SDK is a .NET library that contains kepler interfaces for import service.\nIt provides and simplifies executing import in client application.\nRelativity.Import.SDK targets .NET Framework 4.6.2\n\n**NOTE: Use this package when your application USE Kepler.**\n\n\n[![Version](https://img.shields.io/nuget/v/Relativity.Import.SDK.svg?color=royalblue)](https://www.nuget.org/packages/Relativity.Import.SDK)\n[![Downloads](https://img.shields.io/nuget/dt/Relativity.Import.SDK?color=green)](https://www.nuget.org/packages/Relativity.Import.SDK)\n\u003cbr\u003e  \n\n### **Installing via NuGet** \n\n        Install-Package Relativity.Import.SDK \n\n## Relativity.Import.Models.SDK ###\nRelativity.Import.Models.SDK is a .NET library that contains contract models for API and [builders](#builders) which help user to prepare payloads in correct and consistent way.\nRelativity.Import.Models.SDK targets .NET Standard 2.0. The NuGet package also includes direct targets for .NET Framework 4.6.2.\n\u003cbr/\u003e  \n**NOTE:**\nThis package is automatically installed as dependency when using Relativity.Import.SDK.\n\n**NOTE:** You can install this package directly when your application does not use Kepler.\n\u003cbr/\u003e \n\n\n[![Version](https://img.shields.io/nuget/v/Relativity.Import.Models.SDK.svg?color=royalblue)](https://www.nuget.org/packages/Relativity.Import.Models.SDK)\n[![Downloads](https://img.shields.io/nuget/dt/Relativity.Import.Models.SDK?color=green)](https://www.nuget.org/packages/Relativity.Import.Models.SDK)\n### **Installing via NuGet** \n        Install-Package Relativity.Import.Models.SDK\n\n---\n## Authorization\n\u003e HTTP clients \n\nImport Service API conforms to the same authentication rules as other Relativity REST APIs. \n\nThe more details can be found under the following link:\n[REST_API_authentication](https://platform.relativity.com/RelativityOne/Content/REST_API/REST_API_authentication.htm)\n\n\u003e Kepler .NET client\n\nThe Kepler framework uses a proxy to handle client requests. The more details can be found under the following link:\n[Proxies_and_authentication](https://platform.relativity.com/RelativityOne/Content/Kepler_framework/Proxies_and_authentication.htm#Service)\n\n---\n## Permissions\nThe following Relativity permissions are required to use import features provided in Import Service API.\n\n| Object Security section| Permission |\n| :---- | :----: |\n| •\tDocument |\tView, Add, Edit |\n| •\tRelativity Import Job: |\tView, Add, Edit |\n| •\tRelativity Import Data Source |\tView, Add, Edit |\n\n| Tab Visibility|\n| :---- |\n| •\tDocuments |\n\n| Admin Operation|\n| :---- |\n| •\tAllow Import |\n---\n\u003cbr\u003e  \n\n## Builders\n\nBuilders provided in Relativity.Import.Models.SDK package help to create settings for import job and data source in correct and consistent way. It is highly recommended to prepare these objects in such a way in .NET application. They are implemented in fluent api pattern so it is very easy to use them. Moreover, using them in client application will avoid the risk of incorrect and inconsistent configuration\nwhich may lead to errors during import process.\n\n*ImportDocumentsSettingsBuilder* - builds ImportDocumentsSettings used for import job configuration (documents import).\n\n*ImportRdoSettingsBuilder* - builds ImportRdoSettings used for import job configuration (rdos import).\n\n*DataSourceSettingsBuilder* - builds DataSourceSettings used for data source configuration.\n\n\u003e C#\n\n    // Example of using ImportDocumentSettingsBuilder to create ImportDocumentSettings.\n\n    ImportDocumentSettingsBuilder.Create()\n        .WithOverlayMode(x =\u003e x\n            .WithKeyField(overlayKeyField)\n            .WithMultiFieldOverlayBehaviour(MultiFieldOverlayBehaviour.MergeAll))\n        .WithNatives(x =\u003e x\n            .WithFilePathDefinedInColumn(filePathColumnIndex)\n            .WithFileNameDefinedInColumn(fileNameColumnIndex))\n        .WithoutImages()\n        .WithFieldsMapped(x =\u003e x\n            .WithField(controlNumberColumnIndex, \"Control Number\")\n            .WithExtractedTextInSeparateFiles(f =\u003e f\n\t\t.WithEncoding(\"UTF-16\")\n\t\t.WithFileSizeDefinedInColumn(fileSizeColumnIndex))))\n        .WithFolders(f =\u003e f\n            .WithRootFolderID(rootFolderId, r =\u003e r\n                .WithFolderPathDefinedInColumn(folderPathColumnIndex)));\n\n\n\u003e C#\n\n    // Example of using DataSourceSettingsBuilder to create DataSourceSettings.\n\n    DataSourceSettings dataSourceSettings = DataSourceSettingsBuilder.Create()\n        .ForLoadFile(loadFile01Path)\n        .WithDelimiters(d =\u003e d\n            .WithColumnDelimiters('|')\n            .WithQuoteDelimiter('^')\n            .WithNewLineDelimiter('#')\n            .WithNestedValueDelimiter('\u0026')\n            .WithMultiValueDelimiter('$'))\n        .WithFirstLineContainingHeaders()\n        .WithEndOfLineForWindows()\n        .WithStartFromBeginning()\n        .WithDefaultEncoding()\n        .WithDefaultCultureInfo();\n\n\nNOTE: Please review the samples to find more about builders.\n***\n## General Import flow description\nThe general flow includes several steps consisted in sending appropriate HTTP requests.\n\n1. **Create Import Job** \n\n   Creates import job entity in particular workspace. Job is defined by its unique Id generated by user and provided in the request which is used in the next steps.\n\n2. **Configure Import Job**\n\n    Configures existing import job by defining sets of significant parameters including import type, its mode, fields mapping. This step covers two configuration options: \n    - Documents Configuration \n\n    - Rdos Configuration.\n  \n3. **Add one or multiple DataSources**\n\n    Creating data source entity or entities for particular import job. It represents the configuration that corresponds to dataset being imported. Data source is identified by its unique Id generated by user and provided in the request. Data source configuration includes path to “load file” and other significant parameters telling how data in load file will be read and interpreted by system.\n\n    Many data sources can be added to the same import job. Data sources can be added both before job is started and after, so user can add additional sources to running importJob.\n\n4. **Begin Job**  \n  Starts Import Job which enables the process that schedules importing data to workspace based on the configuration assigned in previous steps.\n  Started job does not mean that data are instantly imported. However DataSources are added to the queue and scheduled by background mechanism.\n  The import Job state or data source state shows the current stage. \n\n5. **Cancel Job**\nUser can cancel running Import Job in every moment. All related data sources will not be imported except for those whose import has already started.\n\n6. **End Import Job** \n  Ends import job that was already started. It is optional step but it is highly recommended in case when no more data source is plan to be added for particular job. All data sources added to the job before the end request was sent will be imported.\n\n## Example of Simple Import Documents Flow\n1.  **Create Import Job** \n        \n    \u003e curl\n    \n         curl -X POST 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/e694ad62-198d-4ecb-936d-1862ddfa4235'\n        -H 'X-CSRF-Header: -' \n        -d '{\n        \"applicationName\": \"simpleImportDocuments\",\n        \"correlationID\": \"c0r31ati0n_ID\"\n        }'\n\u003cbr\u003e\n\n2. **Create Import Job Configuration** \n\n    \u003e curl\n\n        curl -X POST \\'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/e694ad62-198d-4ecb-936d-1862ddfa4235/documents-configurations/' \n        -H 'X-CSRF-Header: -' \n        -d \"$importSettingsPayloadJson\"\n\n\n    Import Configuration payload example:\n\n    \u003e JSON\n\n        {\n        \"importSettings\": {\n            \"Overlay\":null,\n            \"Native\":{\n                \"FilePathColumnIndex\": \"22\",\n                \"FileNameColumnIndex\": \"13\"\n            },\n            \"Image\": null,\n            \"Fields\": {\n                \"FieldMappings\": [\n                    {\n                    \"ColumnIndex\": 0,\n                    \"Field\": \"Control Number\",\n                    \"ContainsID\": false,\n                    \"ContainsFilePath\": false\n                    },\n            ]\n            },\n            \"Folder\": {\n                \"RootFolderID\": 1003663,\n                \"FolderPathColumnIndex\": 2\n            }\n        }\n        }'\n\n    \u003e C#  Builders\n\n        ImportDocumentSettings importSettings = ImportDocumentSettingsBuilder.Create()\n            .WithAppendMode()\n            .WithNatives(x =\u003e x\n                .WithFilePathDefinedInColumn(filePathColumnIndex)\n                .WithFileNameDefinedInColumn(fileNameColumnIndex))\n            .WithoutImages()\n            .WithFieldsMapped(x =\u003e x\n                .WithField(controlNumberColumnIndex, \"Control Number\")\n            .WithFolders(f =\u003e f\n                .WithRootFolderID(rootFolderId, r =\u003e r\n                    .WithFolderPathDefinedInColumn(folderPathColumnIndex)));\n\n    \u003e C# \n\n        ImportDocumentSettings importSettings = new ImportDocumentSettings()\n        {\n            Overlay = null,\n            Native = new NativeSettings\n            {\n                FileNameColumnIndex = fileNameColumnIndex,\n                FilePathColumnIndex = filePathColumnIndex,\n            },\n            Fields = new FieldsSettings\n            {\n                FieldMappings = new[]\n                {\n                    new FieldMapping\n                    {\n                        Field = \"Control Number\",\n                        ContainsID = false,\n                        ColumnIndex = 0,\n                        ContainsFilePath = false,\n                    },\n                },\n            },\n            Folder = new FolderSettings\n            {\n                FolderPathColumnIndex = folderPathColumnIndex,\n                RootFolderID = 1003663,\n            },\n            Other = null,\n        };\n\n\u003cbr\u003e\n\n3. **Add DataSource** \n    \u003e curl\n\n        curl -X POST 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/e694ad62-198d-4ecb-936d-1862ddfa4235/sources/0cb922a2-8df4-42fd-9429-c241410a0d1e'\n        -H 'X-CSRF-Header: -' \\\n        -H 'Content-Type: application/json' \n        -d \"$dataSourceSettingsJson\"\n        }'\n\n    Data source configuration payload example:\n\n    \u003e JSON\n\n        {\n        \"dataSourceSettings\": {\n            \"Path\": \"\\\\\\\\files\\\\T001\\\\StructuredData\\\\Import\\\\SampleDataSources\\\\load_file.dat\",\n            \"FirstLineContainsColumnNames\": true,\n            \"StartLine\": 1,\n            \"ColumnDelimiter\": \"|\",\n            \"QuoteDelimiter\": \"^\",\n            \"NewLineDelimiter\": \"#\",\n            \"MultiValueDelimiter\": \";\",\n            \"NestedValueDelimiter\": \"\u0026\",\n            \"EndOfLine\" = 0\n             Encoding\" = null\n            \"CultureInfo\" : \"en-US\",\n            \"Type\": 2\n            }\n        }'\n\n    \u003e C# builders\n   \n\t\t\tDataSourceSettings dataSourceSettings = DataSourceSettingsBuilder.Create()\n\t\t\t\t.ForLoadFile(\"\\\\\\\\files\\\\T001\\\\StructuredData\\\\Import\\\\SampleDataSources\\\\load_file.dat\")\n\t\t\t\t.WithDelimiters(d =\u003e d\n\t\t\t\t\t.WithColumnDelimiters('|')\n\t\t\t\t\t.WithQuoteDelimiter('^')\n\t\t\t\t\t.WithNewLineDelimiter('#')\n\t\t\t\t\t.WithNestedValueDelimiter('\u0026')\n\t\t\t\t\t.WithMultiValueDelimiter(';'))\n\t\t\t\t.WithFirstLineContainingHeaders()\n\t\t\t\t.WithEndOfLineForWindows()\n\t\t\t\t.WithStartFromBeginning()\n\t\t\t\t.WithDefaultEncoding()\n\t\t\t\t.WithDefaultCultureInfo();\n\n    \u003e C#\n\n\t\t\tDataSourceSettings dataSourceSettings = new DataSourceSettings\n\t\t\t{\n\t\t\t\tType = DataSourceType.LoadFile,\n\t\t\t\tPath = \"\\\\\\\\files\\\\T001\\\\StructuredData\\\\Import\\\\SampleDataSources\\\\load_file.dat\",\n\t\t\t\tNewLineDelimiter = '#',\n\t\t\t\tColumnDelimiter = '|',\n\t\t\t\tQuoteDelimiter = '^',\n\t\t\t\tMultiValueDelimiter = ';',\n\t\t\t\tNestedValueDelimiter = '\u0026',\n\t\t\t\tEncoding = null,\n\t\t\t\tCultureInfo = \"en-us\",\n\t\t\t\tEndOfLine = DataSourceEndOfLine.Windows,\n\t\t\t\tFirstLineContainsColumnNames = true,\n\t\t\t\tStartLine = 0,\n\t\t\t};\n\n\u003cbr\u003e\n\n4. **Begin Job**\n    \u003e curl\n\n        curl -X POST 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/e694ad62-198d-4ecb-936d-1862ddfa4235/begin/' \n        -H 'X-CSRF-Header: -' \n        -d ''\n\n\u003cbr\u003e\n\n5. **End Import Job** \n\n    \u003e curl\n\n        curl -X POST 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/e694ad62-198d-4ecb-936d-1862ddfa4235/end/'\n        -H 'X-CSRF-Header: -' \n        -d ''\n\n\n\n\u003cbr\u003e\u003cbr\u003e\n\n## Example of Simple Import Images Flow\n1. **Create Import Job** \n    \u003e curl\n\n        curl -X POST 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/4c4215bf-d8a3-48d4-a3e0-3a40428415e7/'\n        -H 'X-CSRF-Header: -' \n        -d '{\n        \"applicationName\": \"simpleImportImages\",\n        \"correlationID\": \"img0r22ati0n_ID\"\n        }'\n\n2. **Create Import Job Configuration**\n    \u003e curl\n\n        curl -X POST \\'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/4c4215bf-d8a3-48d4-a3e0-3a40428415e7/documents-configurations/' \n        -H 'X-CSRF-Header: -' \n        -d \"$importSettings\"\n\n    Import Configuration payload example:\n\n    \u003eJSON\n\n        {\n        \"importSettings\": {\n            \"Overlay\":null,\n            \"Native\":null,\n        \"Image\": \n            {\n                \"PageNumbering\": 1,\n                \"ProductionID\": null,\n                \"LoadExtractedText\": false,\n                \"FileType\": 0    \n            }\n            \"Fields\": null,\n            \"Folder\": null\n            }\n        }'\n\n    \u003e  C# Builder\n\n        ImportDocumentSettings importSettings = ImportDocumentSettingsBuilder.Create()\n            .WithAppendMode()\n            .WithoutNatives()\n            .WithImages(i =\u003e i\n                .WithAutoNumberImages()\n                .WithoutProduction()\n                .WithoutExtractedText()\n                .WithFileTypeAutoDetection())\n            .WithoutFieldsMapped()\n            .WithoutFolders();\n            \n\n3. **Add DataSource** \n\n    \u003e curl\n\n            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'\n            -H 'X-CSRF-Header: -' \\\n            -H 'Content-Type: application/json' \n            -d \"$dataSourceSettingsJson\"\n            }'\n\n    \u003e JSON\n    \n        {\n        \"dataSourceSettings\": {\n            \"Path\": \"\\\\\\\\files\\\\T001\\\\StructuredData\\\\Import\\\\SampleDataSources\\\\opticon_file.opt\",\n            \"FirstLineContainsColumnNames\": false,\n            \"StartLine\": 0;\n            \"EndOfLine\" = 0\n             Encoding\" = null\n            \"CultureInfo\" : null,\n            \"Type\": 1\n            }\n        }'\n\n\n    \u003e C# Builders\n\n\t\t\tDataSourceSettings dataSourceSettings = DataSourceSettingsBuilder.Create()\n\t\t\t\t.ForOpticonFile(\"\\\\\\\\files\\\\T001\\\\StructuredData\\\\Import\\\\SampleDataSources\\\\opticon_file.opt\")\n\t\t\t\t.WithDefaultDelimitersForOpticonFile()\n\t\t\t\t.WithEndOfLineForWindows()\n\t\t\t\t.WithStartFromBeginning()\n\t\t\t\t.WithDefaultEncoding()\n\t\t\t\t.WithDefaultCultureInfo();\n\n    \u003e C#\n\n\t\t\tDataSourceSettings dataSourceSettings = new DataSourceSettings\n\t\t\t{\n\t\t\t\tType = DataSourceType.Opticon,\n\t\t\t\tPath = \"\\\\\\\\files\\\\T001\\\\StructuredData\\\\Import\\\\SampleDataSources\\\\opticon_file.opt\",\n\t\t\t\tNewLineDelimiter = default,\n\t\t\t\tColumnDelimiter = default,\n\t\t\t\tQuoteDelimiter = default,\n\t\t\t\tMultiValueDelimiter = default,\n\t\t\t\tNestedValueDelimiter = default,\n\t\t\t\tEncoding = null,\n\t\t\t\tCultureInfo = null,\n\t\t\t\tEndOfLine = DataSourceEndOfLine.Windows,\n\t\t\t\tFirstLineContainsColumnNames = false,\n\t\t\t\tStartLine = 0,\n\t\t\t};\n\n\u003cbr\u003e\n\n4. **Begin Job** \n    \u003e curl\n\n        curl -X POST 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/4c4215bf-d8a3-48d4-a3e0-3a40428415e7/begin/' \n        -H 'X-CSRF-Header: -' \n        -d ''\n\n5. **End Import Job** \n    \u003e curl\n\n        curl -X POST 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/4c4215bf-d8a3-48d4-a3e0-3a40428415e7/end/'\n        -H 'X-CSRF-Header: -' \n        -d ''\n\n\u003cbr\u003e\u003cbr\u003e\n\n## Example of Simple Import Relativity Dynamic Objects (RDO) Flow\n\n1. **Create Import Job** \n    \u003e curl\n    \n        curl -X POST 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/77140fb9-f515-4b65-a2ce-c347492e2905/'\n        -H 'X-CSRF-Header: -' \n        -d '{\n        \"applicationName\": \"simpleImportRdo\",\n        \"correlationID\": \"rdor31ati0n_ID\"\n        }'\n\n2. **Create Import Job Configuration**\n\n    \u003e curl\n\n        curl -X POST \\'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/77140fb9-f515-4b65-a2ce-c347492e2905/rdo-configurations/' \n        -H 'X-CSRF-Header: -' \n        -d $\"importRdoSettings\"'\n\n\n    Import RDO Configuration payload example:\n\n     \u003e JSON\n\n        {\n            \"importSettings\": {\n                \"OverwriteMode\": \"Append\",\n                \"Fields\": {\n                \"FieldMappings\": [\n                    {\n                    \"ColumnIndex\": 0,\n                    \"Field\": \"Name\"\n                    },\n                    ]\n                },\n                \"Rdo\": {\n                    \"ArtifactTypeID\": 1000066,\n                    \"ParentColumnIndex\" :null\n                },\n            }\n        }\n\n    \u003e C# Builder\n        \n        ImportRdoSettings importSettings = ImportRdoSettingsBuilder.Create()\n            .WithAppendMode()\n            .WithFieldsMapped(f =\u003e f\n                .WithField(nameColumnIndex, \"Name\")\n            .WithRdo(r =\u003e r\n                .WithArtifactTypeId(domainArtifactTypeID)\n                .WithoutParentColumnIndex());\n\n    \u003e C# \n\n        ImportRdoSettings importSettings = new ImportRdoSettings()\n        {\n            Overlay = null,\n            Fields = new FieldsSettings\n            {\n                FieldMappings = new[]\n                {\n                    new FieldMapping\n                    {\n                        Field = \"Name\",\n                        ContainsID = false,\n                        ColumnIndex = nameColumnIndex,\n                        ContainsFilePath = false,\n                    },\n                },\n            },\n            Rdo = new RdoSettings\n            {\n                ArtifactTypeID = rdoArtifactTypeID,\n                ParentColumnIndex = null,\n            },\n        };\n\n\n3. **Add DataSource** \n    \u003e curl\n\n        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'\n        -H 'X-CSRF-Header: -' \\\n        -H 'Content-Type: application/json' \n        -d \"$dataSourceSettingsJson\"\n        }'\n\n    Data source configuration payload example:\n\n    \u003e JSON\n\n        {\n        \"dataSourceSettings\": {\n            \"Path\": \"\\\\\\\\files\\\\T001\\\\StructuredData\\\\Import\\\\SampleDataSources\\\\load_file.dat\",\n            \"FirstLineContainsColumnNames\": true,\n            \"StartLine\": 1,\n            \"ColumnDelimiter\": \"|\",\n            \"QuoteDelimiter\": \"^\",\n            \"NewLineDelimiter\": \"#\",\n            \"MultiValueDelimiter\": \";\",\n            \"NestedValueDelimiter\": \"\u0026\",\n            \"EndOfLine\" = 0\n            Encoding\" = null\n            \"CultureInfo\" : \"en-US\",\n            \"Type\": 2\n            }\n        }'\n\n    \u003e C# builder\n   \n\t\t\tDataSourceSettings dataSourceSettings = DataSourceSettingsBuilder.Create()\n\t\t\t\t.ForLoadFile(\"\\\\\\\\files\\\\T001\\\\StructuredData\\\\Import\\\\SampleDataSources\\\\load_file.dat)\n\t\t\t\t.WithDelimiters(d =\u003e d\n\t\t\t\t\t.WithColumnDelimiters('|')\n\t\t\t\t\t.WithQuoteDelimiter('^')\n\t\t\t\t\t.WithNewLineDelimiter('#')\n\t\t\t\t\t.WithNestedValueDelimiter('\u0026')\n\t\t\t\t\t.WithMultiValueDelimiter(';'))\n\t\t\t\t.WithFirstLineContainingHeaders()\n\t\t\t\t.WithEndOfLineForWindows()\n\t\t\t\t.WithStartFromBeginning()\n\t\t\t\t.WithDefaultEncoding()\n\t\t\t\t.WithDefaultCultureInfo();\n\n    \u003e C#\n\n\t\t\tDataSourceSettings dataSourceSettings = new DataSourceSettings\n\t\t\t{\n\t\t\t\tType = DataSourceType.LoadFile,\n\t\t\t\tPath = \"\\\\\\\\files\\\\T001\\\\StructuredData\\\\Import\\\\SampleDataSources\\\\load_file.dat\",\n\t\t\t\tNewLineDelimiter = '#',\n\t\t\t\tColumnDelimiter = '|',\n\t\t\t\tQuoteDelimiter = '^',\n\t\t\t\tMultiValueDelimiter = ';',\n\t\t\t\tNestedValueDelimiter = '\u0026',\n\t\t\t\tEncoding = null,\n\t\t\t\tCultureInfo = \"en-us\",\n\t\t\t\tEndOfLine = DataSourceEndOfLine.Windows,\n\t\t\t\tFirstLineContainsColumnNames = true,\n\t\t\t\tStartLine = 0,\n\t\t\t};\n\n\n\n4. **Begin Job** \n\n    \u003e curl\n\n        curl -X POST 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/77140fb9-f515-4b65-a2ce-c347492e2905/begin/' \n        -H 'X-CSRF-Header: -' \n        -d ''\n\n5. **End Import Job** \n\n    \u003e curl\n\n        curl -X POST 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/77140fb9-f515-4b65-a2ce-c347492e2905/end/'\n        -H 'X-CSRF-Header: -' \n        -d ''\n---\n\n### REST API\n\n Review the open API spec for import service: [OpenAPI spec](https://github.com/relativitydev/relativity-import-samples/blob/main/OpenAPI/openapidoc.json)\n\n\n## API Response\n\nEach HTTP response to POST request has unified schema:\n\n        {\n        \"IsSuccess\": true,\n        \"ErrorMessage\": \"\",\n        \"ErrorCode\": \"\",\n        \"ImportJobID\": \"00000000-0000-0000-0000-000000000000\"\n        }\n\nEach HTTP response to GET requests has unified schema:\n\n        {\n        \"Value\": {\n            ....\n            ....\n        },\n        \"IsSuccess\": true,\n        \"ErrorMessage\": \"\",\n        \"ErrorCode\": \"\",\n        \"ImportJobID\": \"00000000-0000-0000-0000-000000000000\"\n        }\n\n---\n\n## Import Job States\n\nImport job state can be read from  GET Import Job details response\n\n\u003e curl \n\n    curl -X GET 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/ca04baf0-4a1a-4787-94d8-5bba89d2eb0f/details' \n    -H 'X-CSRF-Header: -'\n\n \u003e response JSON\n\n\n    {\n        \"Value\": {\n            \"IsFinished\": false,\n            \"State\": \"New\",\n            \"ApplicationName\": \"import demo\",\n            \"Errors\": [],\n            \"CreatedBy\": 9,\n            \"CreatedOn\": \"2023-01-11T13:47:45.513\",\n            \"LastModifiedBy\": 9,\n            \"LastModifiedOn\": \"2023-01-11T13:47:45.513\"\n        },\n        \"IsSuccess\": true,\n        \"ErrorMessage\": \"\",\n        \"ErrorCode\": \"\",\n        \"ImportJobID\": \"ca04baf0-4a1a-4787-94d8-5bba89d2eb0f\"\n    }\n\n| value | State                       | Description                                                                                       |\n|-------|-----------------------------|---------------------------------------------------------------------------------------------------|\n| 10    | New                         | Initial state, job created.                                                                       |\n| 13    | Configured                  | Job has been configured and is ready to begin.                                                    |\n| 16    | InvalidConfiguration        | Job has been configured but the configuration is invalid.                                         |\n| 20    | Idle                        | Job is ready for running but is waiting on new data source or all data source has been processed. |\n| 22    | Scheduled                   | Job is ready waiting on queue to begin the process of import.                                     |\n| 25    | Inserting                   | Job is executing, import of data source is currently in progress.                                 |\n| 26    | PendingCompletion_Scheduled | Job is ended but data source is still waiting on queue to begin the process of import.            |\n| 27    | PendingCompletion_Inserting | Job is ended but the import of data source is currently in progress.                              |\n| 29    | Paused                      | Job is paused and waiting.                                                                        |\n| 30    | Canceled                    | Job canceled.                                                                                     |\n| 40    | Failed                      | Job has failed to import data.                                                                    |\n| 50    | Completed                   | Job has ended with success.                                                                      |\n\n## Import Data Source States\n\nData source state can be read from GET Data source details response\n\n\u003e curl \n\n    curl -X GET 'https://relativity-host/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/ca04baf0-4a1a-4787-94d8-5bba89d2eb0f/sources/40ddb007-4330-41cc-b5aa-2ea6961073a5/details' \n    -H 'X-CSRF-Header: -'\n\n \u003e response JSON\n\n        {\n            \"Value\": {\n                \"State\": \"New\",\n                \"DataSourceSettings\": {\n                    ...\n                    ...\n                },\n                \"JobLevelErrors\": []\n            },\n            \"IsSuccess\": true,\n            \"ErrorMessage\": \"\",\n            \"ErrorCode\": \"\",\n            \"ImportJobID\": \"ca04baf0-4a1a-4787-94d8-5bba89d2eb0f\"\n        }\n\n\n| Value   |   State            |                   Description                                   |\n|----|-------------------------|-----------------------------------------------------------------|\n| 0  | Unknown                 | Invalid state for a data source.                                |\n| 10 | New                     | Initial state, data source was created.                         |\n| 22 | Scheduled               | Data source is waiting on queue to begin the process of import. |\n| 24 | PendingInserting        | Data source has been sent to Worker to begin the import.        |\n| 25 | Inserting               | Data source is currently in progress of processing.             |\n| 30 | Canceled                | Data source canceled.                                           |\n| 40 | Failed                  | Failed to import data from Data source.                         |\n| 45 | CompletedWithItemErrors |  Data source processed, import finished with item errors.       |\n| 50 | Completed               | Data source processed, import finished.                         |\n|    |                         |                                                                 |\n\n# Errors\n## General remarks\nImport service throws two kind of errors:\n - job level errors\n - item level errors.\n\n Job level errors are severe enough to cause the entire import job to fail. These errors can be found in the *GetDetailsAsync* endpoints for *IImportJobController* and *IImportSourceController*.\n\n Item level errors are specific to rows within the data source being imported. Unlike job level errors, item level errors do not cause the entire import job to fail. Instead, they are logged and the import process continues with the next row from the load file.\n Item level errors can result in whole record, meaning document or RDO, not being imported to the workspace or the record in the workspace can be incomplete.\n You can retrieve all item level errors that occurred during the import process from *GetItemErrorsAsync* endpoint for *IImportSourceController*.\n\n## Retrieving errors\n\nError handling in Import Service returns Error Codes and Error Messages:\n - in every response for failed HTTP request\n - when requested by user for all job level errors that occurred during importing of particular data source e.g.:\n\n \u003e curl\n\n        curl -X GET 'https://relativity.roadie.so/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/00000000-0000-0000-0000-000000000000/sources/00000000-0000-0000-0000-000000000000/details'\n        -H 'accept: application/json'\n        -H 'X-CSRF-Header: -'\n\n\n  \u003e JSON response\n\n    {\n\t\"Value\": {\n\t\t\"State\": \"Failed\",\n\t\t\"DataSourceSettings\": {\n\t\t    Path\": \"file.dat\",\n\t\t    \"EndOfLine\": \"Windows\",\n\t\t    \"Type\": \"LoadFile\",\n\t\t    \"FirstLineContainsColumnNames\": true,\n\t\t    \"StartLine\": 0,\n\t\t    \"Encoding\": \"utf-8\"\n\t\t    \"ColumnDelimiter\": \"a\",\n\t\t    \"QuoteDelimiter\": \"b\",\n\t\t    \"NewLineDelimiter\": \"c\",\n\t\t    \"MultiValueDelimiter\": \"d\",\n\t\t    \"NestedValueDelimiter\": \"e\"\n\t\t},\n\t\t\"JobLevelErrors\": [\n\t\t{\n\t\t\"LineNumber\": -1,\n\t\t\"ErrorDetails\": [\n\t\t        {\n\t\t            \"ColumnIndex\": -1,\n\t\t            \"ErrorCode\": \"S.RD.EXT.0217\",\n\t\t            \"ErrorMessage\": \"Cannot read Data Source. Could not open file for reading by RestartableStream.\",\n\t\t            \"ErrorMessageTemplate\": \"Cannot read Data Source. Could not open file for reading by RestartableStream.\",\n\t\t            \"ErrorProperties\": {}\n\t\t        }\n\t\t    ]\n\t\t},\n\t\t\"CreatedBy\": 777,\n\t\t\"CreatedOn\": \"2022-10-18T15:09:12.69\",\n\t\t\"LastModifiedBy\": 777,\n\t\t\"LastModifiedOn\": \"2022-10-18T15:10:00.497\"\n\t},\n\t\"IsSuccess\": true,\n\t\"ErrorMessage\": \"\",\n\t\"ErrorCode\": \"\",\n\t\"ImportJobID\": \"00000000-0000-0000-0000-000000000000\"\n\t}\n\n- when requested by user for all item errors that occurred during importing of particular data source e.g.:\n\n \u003e curl\n\n        curl -X GET 'https://relativity.roadie.so/Relativity.REST/api/import-service/v1/workspaces/10000/import-jobs/00000000-0000-0000-0000-000000000000/sources/00000000-0000-0000-0000-000000000000/itemerrors?start=0\u0026length=10'\n        -H 'accept: application/json'\n        -H 'X-CSRF-Header: -'\n\n\n  \u003e JSON response\n\n    {\n    \"Value\": {\n        \"DataSourceID\": \"00000000-0000-0000-0000-000000000000\",\n        \"Errors\": [\n        {\n            \"ErrorDetails\": [\n            {\n                \"ColumnIndex\": 1,\n                \"ErrorCode\": \"S.LN.INT.0001\",\n                \"ErrorMessage\": \"Error message.\",\n                \"ErrorMessageTemplate\": \"Template error message.\",\n                \"ErrorProperties\": {\n                \"additionalProp1\": \"string\",\n                \"additionalProp2\": \"string\",\n                \"additionalProp3\": \"string\"\n                }\n            }\n            ],\n            \"LineNumber\": 1\n        }\n        ],\n        \"TotalCount\": 1,\n        \"NumberOfSkippedRecords\": 0,\n        \"NumberOfRecords\": 1,\n        \"HasMoreRecords\": false\n    },\n    \"IsSuccess\": true,\n    \"ErrorMessage\": \"\",\n    \"ErrorCode\": \"\",\n    \"ImportJobID\": \"00000000-0000-0000-0000-000000000000\"\n    }\n\n## Error code structure\n\nError code returned from the Import Service API endpoint has the following structure:\n\n**[Resource].[Action].[ErrorType].[ErrorNumber]**\n\nExamples:\n\n|Error code      |Description                                      |\n|----------------|-------------------------------------------------|\n|J.CR.VLD.1501   |Cannot create job because validation has failed. |\n\n\n\n\nResources\n---\n|Resource code|Description  |\n|-------------|-------------|\n|J            |Job          |\n|C            |Document Configuration|\n|S            |Source       |\n|E            |ItemErrors   |\n|R            |RDO Configuration    |\n\nActions\n---\n|Action   code|Description         |\n|-------------|--------------------|\n|BEG          |Begin               |\n|CR           |Create              |\n|CNL          |Cancel              |\n|END          |End                 |\n|GET          |Get                 |\n|GET_COL      |Get columns         |\n|GET_CFG      |Get config          |\n|GET_DAT      |Get data            |\n|GET_DTLS     |Get details         |\n|GET_PRG      |Get progress        |\n|LN           |Line                |\n|PS           |Pause               |\n|RD           |Read                |\n|RES          |Resume              |\n|RUN          |Run                 |\n\nError Types\n---\n|Error type code|Description                         |\n|---------------|------------------------------------|\n|INT            |Internal service error              |\n|EXT            |External dependency error           |\n|VLD            |Validation error                    |\n\nError Numbers\n---\nError number has 4 digits. Digits on the first and on the second position has the special meaning.\n\nMeaning of the first digit is the same for all error types.\n\n|Resource code|Description                                    |\n|-------------|-----------------------------------------------|\n|0XXX         |General error                                  |\n|1XXX         |Job related error                              |\n|2XXX         |Configuration related error                    |\n|3XXX         |Source related error                           |\n|4XXX         |ItemErrors related error                       |\n\nMeaning of the second digit differs for each error type.\n\n|Error Type |Resource code|Description                                    |\n|-----------|-------------|-----------------------------------------------|\n|INT        |X[0-9]XX     |Service errors                                  |\n|EXT        |X[0-9]XX     |Runtime errors                                  |\n|VLD        |X0XX         |Invalid input data                             |\n|VLD        |X5XX         |System state does not allow to execute request |\n|VLD        |X6XX         |Data in the system does not exist              |\n|VLD        |X7XX         |Data in the system is incorrect                |\n|VLD        |X9XX         |Data in the system is corrupted                |\n\n\n\u003cbr\u003e\u003cbr\u003e\n\n---\n# Samples\n\n## Samples types and structure\nThere are three types of sample application that demonstrate the use of Import Service API features.\n- DotNetClientConsole - .NET console application  (.NET 7, C#).\n- KeplerClientConsole - .NET console application (.NET Framework 4.6.2, Kepler client, C#).\n- REST client -  Powershell scripts.\n\nExamples structure:\n- Each code example for particular import flow is contained in separate file (e.g. [Sample04_AddDataSourceToRunningJob.cs](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample04_AddDataSourceToRunningJob.cs)).\n- Each sample is numbered. Number of sample is included in file and class name.\n- 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.\n- Sample code contains accurate comments describing the flow. \n- Expected console result of demonstrated sample flow is included at the end of the file. \n- Repository with samples contains also structured data set used in all examples - load files, opticon files, folders structure with native files, images, text files.\n\nList of samples:\n| Sample name | .NET | .Net Framework \u0026 Kepler | PowerShell |\n| :---- | :----: | :----: | :----: |\n | Sample01_ImportNativeFiles | [Sample01](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample01_ImportNativeFiles.cs) | [Sample01](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample01_ImportNativeFiles.cs) | [Sample01](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample01-import-native-files.ps1) | \n | Sample02_ImportDocumentsInOverlayMode | [Sample02](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample02_ImportDocumentsInOverlayMode.cs) | [Sample02](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample02_ImportDocumentsInOverlayMode.cs) | [Sample02](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample02-import-documents-in-overlay-mode.ps1) | \n| Sample03_ImportFromTwoDataSources | [Sample03](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample03_ImportFromTwoDataSources.cs) | [Sample03](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample03_ImportFromTwoDataSources.cs) | [Sample03](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample03-import-from-two-data-sources.ps1) | \n| Sample04_AddDataSourceToRunningJob|  [Sample04](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample04_AddDataSourceToRunningJob.cs) | [Sample04](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample04_AddDataSourceToRunningJob.cs) | [Sample04](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample04-add-data-source-to-running-job.ps1) | \n| Sample05_ImportDocumentsWithExtractedText | [Sample05](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample05_ImportDocumentsWithExtractedText.cs) | [Sample05](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample05_ImportDocumentsWithExtractedText.cs) | [Sample05](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample05-import-documents-with-extracted-text.ps1) | \n| Sample06_ImportDocumentsToSelectedFolder | [Sample06](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample06_ImportDocumentsToSelectedFolder.cs) | [Sample06](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample06_ImportDocumentsToSelectedFolder.cs) | [Sample06](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample06-import-documents-to-selected-folder.ps1) | \n| Sample07_DirectImportSettingsForDocuments.cs | [Sample07](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample07_DirectImportSettingsForDocuments.cs) | [Sample07](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample07_DirectImportSettingsForDocuments.cs) | [Sample07](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample07-direct-import-settings-for-documents.ps1) | \n| Sample08_ImportImages | [Sample08](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample08_ImportImages.cs) | [Sample08](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample08_ImportImages.cs) | [Sample08](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample08-import-images.ps1) | \n | Sample09_ImportProductionFiles | [Sample09](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample09_ImportProductionFiles.cs) | [Sample09](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample09_ImportProductionFiles.cs) | [Sample09](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample09-import-production-files.ps1) | \n | Sample10_ImportImagesInAppendOverlayMode |[Sample10](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample10_ImportImagesInAppendOverlayMode.cs) | [Sample10](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample10_ImportImagesInAppendOverlayMode.cs) | [Sample10](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample10-import-images-in-append-overlay-mode.ps1) | \n | Sample11_DirectImportSettingsForImages| [Sample11](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample11_DirectImportSettingsForImages.cs) | [Sample11](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample11_DirectImportSettingsForImages.cs) | [Sample11](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample11-direct-import-settings-for-images.ps1) | \n | Sample12_ImportRelativityDynamicObject | [Sample12](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample12_ImportRelativityDynamicObject.cs) | [Sample12](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample12_ImportRelativityDynamicObject.cs) | [Sample12](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample12-import-relativity-dynamic-object.ps1) | \n | Sample13_ImportRdoWithParent | [Sample13](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample13_ImportRdoWithParent.cs) | [Sample13](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample13_ImportRdoWithParent.cs) | [Sample13](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample13-import-rdo-with-parent.ps1) | \n | Sample14_DirectImportSettingsForRdo | [Sample14](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample14_DirectImportSettingsForRdo.cs) | [Sample14](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample14_DirectImportSettingsForRdo.cs) | [Sample14](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample14-direct-import-settings-for-rdo.ps1) | \n | Sample15_ReadImportRdoSettings|  [Sample15](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample15_ReadImportRdoSettings.cs) | [Sample15](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample15_ReadImportRdoSettings.cs) | [Sample15](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample15-read-import-rdo-settings.ps1) | \n | Sample16_ReadImportDocumentSettings | [Sample16](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample16_ReadImportDocumentSettings.cs) | [Sample16](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample16_ReadImportDocumentSettings.cs) | [Sample16](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample16-read-import-document-settings.ps1) | \n | Sample17_GetImportJobs | [Sample17](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample17_GetImportJobs.cs) | [Sample17](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample17_GetImportJobs.cs) | [Sample17](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample17-read-import-jobs.ps1) | \n | Sample18_GetDataSource | [Sample18](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample18_GetDataSource.cs) | [Sample18](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample18_GetDataSource.cs) | [Sample18](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample18-get-data-source.ps1) | \n | Sample19_GetImportJobDetailsAndProgress | [Sample19](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample19_GetImportJobDetailsAndProgress.cs) | [Sample19](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample19_GetImportJobDetailsAndProgress.cs) | [Sample19](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample19-get-import-job-details-and-progress.ps1) | \n | Sample20_GetDataSourceDetailsAndProgress | [Sample20](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample20_GetDataSourceDetailsAndProgress.cs) | [Sample20](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample20_GetDataSourceDetailsAndProgress.cs) | [Sample20](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample20-get-data-source-details-and-progress.ps1) | \n | Sample21_CancelStartedJob | [Sample21](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample21_CancelStartedJob.cs) | [Sample21](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample21_CancelStartedJob.cs) | [Sample21_](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample21-cancel-started-job.ps1) | \n | Sample22_ReadResponse | [Sample22](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample22_ReadResponse.cs) | [Sample22](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample22_ReadResponse.cs) | [Sample22](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample22-read-response.ps1) | \n | Sample23_GetDataSourceErrors | [Sample23](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/SampleCollection/Sample23_GetDataSourceErrors.cs) | [Sample23](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/SamplesCollection/Sample23_GetDataSourceErrors.cs) | [Sample23](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/SamplesCollection/sample23-get-data-source-errors.ps1) | \n\n## .NET Code Samples - How to\n\n \n To run a sample code:\n \n - Copy the content of [sample dataset](https://github.com/relativitydev/relativity-import-samples/tree/main/SampleDataSources) to your Relativity fileshare.\n - Uncomment line with sample invocation you want to run in Main method.  \n\n            // await sampleCollection.Sample08_ImportImages();\n            // await sampleCollection.Sample09_ImportProductionFiles();\n\n            await sampleCollection.Sample10_ImportImagesInAppendOverlayMode();\n\n - Set the proper credentials and URI of your Relativity instance in [RelativityUserSettings](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/DotNetClientConsole/Helpers/RelativityUserSettings.cs) helper class.\n\n        public class RelativityUserSettings\n        {\n            public const string BaseAddress = \"https://host/Relativity.REST/\";\n\n            public const string UserName = \"sample.user@test.com\";\n\n            public const string Password = \"password!\";\n        }\n\n - Update workspaceId const to the proper value equals Id of the workspace where you intend to import data. It is required in each sample. \n\n \n        // destination workspace artifact Id.\n        const int workspaceId = 1000000;\n\n - Update other Ids related to your workspace - productionSetsArtifactId , rootFolderId,rdoArtifactTypeID. They are required only by specific samples.\n - Update const which defines the path to the load file (e.g. const string  loadFile01Path) according to the location where you copied sample data.\n\n \n\t\t\t// Path to the file in opticon format used in data source settings.\n\t\t\tconst string opticonFilePath = \"\\\\\\\\files\\\\T001\\\\StructuredData\\\\Import\\\\SampleDataSources\\\\opticon_01.opt\";\n\n - Run application \n\n\n\n## KeplerClient Code Samples - How to\n \n To run a sample code:\n \n - Copy the content of [sample dataset](https://github.com/relativitydev/relativity-import-samples/tree/main/SampleDataSources) to your Relativity fileshare.\n - Uncomment line with sample invocation you want to run in Main method.\n - Set the proper credentials and host address of your Relativity instance in [RelativityUserSettings](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/KeplerClientConsole/ImportSampleHelpers/RelativityUserSettings.cs) helper class.\n\n\n \t    public static class RelativityUserSettings\n\t    {\n\t\tpublic const string HostAddress = \"https://host-address\";\n\n\t\tpublic const string UserName = \"sample.user@test.com\";\n\n\t\tpublic const string Password = \"password!\";\n\t    }\n\n - Update workspaceId const to the proper value equal Id of the workspace where you intend to import data. It is required in each sample. \n - Update other Ids related to your workspace - productionSetsArtifactId , rootFolderId,rdoArtifactTypeID. They are required only by specific samples.\n - Update const which defines the path to the load file (e.g. const string  loadFile01Path) according to the location where you copied sample data.\n - Run application \n\n## Powershell Script Samples - How to\n \n To run a sample code:\n \n - Install Powershell \"Pester\" Module  (ver. \u003e= 5.3.3)\n \n        Find-Module -Name \"Pester\" | Install-Module -Force;\n - Copy the content of [sample dataset](https://github.com/relativitydev/relativity-import-samples/tree/main/SampleDataSources) to your Relativity fileshare.\n\n- Uncomment line with sample invocation you want to run in [run-sample-import.ps1](https://github.com/relativitydev/relativity-import-samples/blob/main/Samples/RestSamples/run-sample-import.ps1).\n\n        Describe \"Sample import\" {\n        . \"$global:rootDir\\SamplesCollection\\sample01-import-native-files.ps1\"\n\n        # . \"$global:rootDir\\SamplesCollection\\sample02-import-documents-in-overlay-mode.ps1\"\n\n - Set the proper credentials and host address of your Relativity instance in \"run-sample-import.ps1\".\n\n        $hostAddress = \"https://sample-host/\"\n        $userName = \"sample@username\"\n        $password = \"password!\"\n\n - Update workspaceId  to the proper value equal Id of the workspace where you intend to import data. It is required in each sample. \n\n- Update variable which defines the path to the load file/opticon file (e.g. $opticonFilePath) according to the location where you copied sample data.\n\n        $workspaceId = 1000000\n        $loadFilePath = \"\\\\files\\T001\\StructuredData\\Import\\SampleDataSources\\load_file_01.dat\"\n\n - Update other Ids related to your workspace - productionSetsArtifactId , rootFolderId,rdoArtifactTypeID. They are required only by specific samples.\n\n\n - Invoke run-sample-import.ps1\n\n\u003cbr\u003e\u003cbr\u003e\n\n---\n# Performance Best Practices\n\n## Import Job Settings\n\n### Encoding\nFor best performance, we highly recommend using UTF-16 encoding for any single long text field (including Extracted text). Other encodings are still supported, but will be converted to UTF-16 which will add delay to document or image import process.\n\nFor the document workflow, set **FieldMapping.Encoding** to UTF-16. Similarly, for the image workflow, configure **ImageSettings.ExtractedTextEncoding** as UTF-16. With these settings in place, the conversion overhead is eliminated, and your files will be copied directly in the unicode encoding, resulting in faster processing times.\n\n\t\t\tImportDocumentSettings importDocuments = ImportDocumentSettingsBuilder.Create()\n\t\t\t\t.WithAppendMode()\n\t\t\t\t.WithNatives(x =\u003e x\n\t\t\t\t\t.WithFilePathDefinedInColumn(filePathColumnIndex)\n\t\t\t\t\t.WithFileNameDefinedInColumn(fileNameColumnIndex))\n\t\t\t\t.WithoutImages()\n\t\t\t\t.WithFieldsMapped(x =\u003e x\n\t\t\t\t\t.WithField(controlNumberColumnIndex, \"Control Number\")\n\t\t\t\t\t.WithExtractedTextField(extractedTextPathColumnIndex, e =\u003e e\n\t\t\t\t\t\t.WithExtractedTextInSeparateFiles(f =\u003e f\n\t\t\t\t\t\t\t.WithEncoding(\"UTF-16\")\n\t\t\t\t\t\t\t.WithFileSizeDefinedInColumn(fileSizeColumnIndex))))\n\t\t\t\t.WithoutFolders();\n\n    \n\t\t\tImportDocumentSettings importImages = ImportDocumentSettingsBuilder.Create()\n\t\t\t\t.WithAppendMode()\n\t\t\t\t.WithoutNatives()\n\t\t\t\t.WithImages(i =\u003e i\n\t\t\t\t\t.WithAutoNumberImages()\n\t\t\t\t\t.WithoutProduction()\n\t\t\t\t\t.WithExtractedText(e =\u003e e.WithEncoding(\"UTF-16\"))\n\t\t\t\t\t.WithFileTypeAutoDetection())\n\t\t\t\t.WithoutFieldsMapped()\n\t\t\t\t.WithoutFolders();\n \nIf your mapping contains more than one long text field, you should use UTF-16. No other encodings are supported in this case.\n\n### FileSizeColumnIndex\nAnother valuable setting that can enhance performance is the **FieldMapping.FileSizeColumnIndex**. By configuring this setting, the need for additional file size calculations can be eliminated. The file sizes will be automatically extracted from the load file, streamlining the process and saving valuable processing time.\n\n**Note:** The FileSizeColumnIndex setting will only take effect if FieldMapping.ContainsFilePath is set to true, and the FieldMapping.Encoding is set to UTF-16. This property applies only to long text fields stored in Data Grid, including Extracted Text.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frelativitydev%2Frelativity-import-samples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frelativitydev%2Frelativity-import-samples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frelativitydev%2Frelativity-import-samples/lists"}