Relativity SDK samples
Relativity SDK includes a set of Services API code samples. The samples illustrate how to perform CRUD and query operations on common objects, such as workspaces, documents, batches, RDOs, users, fields, and choices to help you get started with developing on the Relativity Platform.
This page contains the following information:
Before you begin
Before running Relativity SDK samples, complete the following tasks to set up your development environment:
- Verify that you have access to a test environment with admin-level permissions.
Note: You can use any admin-level Relativity account to run the samples.
- Confirm that you have the required software for Platform development. See Set up your development environment.
Run the samples
To run the Relativity SDK API samples:
Note: For the Relativity 9.4.361.1 SDK, an error occurs when you attempt to build the APISamples solution located in kCura.Relativity.Client.APISamples folder as described in the following steps. You can resolve this issue by removing all references to the PasswordBankManager.cs file.
- Open the APISamples solution in Visual Studio.
C:\Program Files\kCura Corporation\Relativity SDK\Services API\kCura.Relativity.Client.APISamples\APISamples.sln
- Specify the Relativity credentials for running the samples in the following app.config files:12
C:\Program Files\kCura Corporation\Relativity SDK\Services API\kCura.Relativity.Client.APISamples\kCura.Relativity.Client.SamplesLibrary.Runner/app.config
C:\Program Files\kCura Corporation\Relativity SDK\Services API\kCura.Relativity.Client.APISamples\kCura.Relativity.Client.SamplesLibrary.GettingStarted/app.config
By default, relativity.admin@kcura.com is specified as the Relativity account. You must supply the password.
123456789101112<?xml version=
"1.0"
?>
<configuration>
<appSettings>
<add key=
"ServerID"
value=
"1015096"
/>
<add key=
"Username"
value=
"relativity.admin@kcura.com"
/>
<add key=
"Password"
value=
"YourPasswordGoesHere"
/>
</appSettings>
<startup>
<supportedRuntime version=
"v4.0"
sku=
".NETFramework,Version=v4.5"
/>
</startup>
</configuration>
- Set kCura.Relativity.Client.SamplesLibrary.Runner as the startup project.
- (Optional) Set the logging level on the Debug Page of the Visual Studio Project Designer.
Valid values include:
--debug
--warning
--error
- Run the solution and follow the instructions in the console window.
- Press any key to set up sample data.
- Press Enter to run all samples. To run a specific set of samples, select a category. For more information about the categories and the operations they illustrate, see Samples reference.
If you log in to Relativity, you can review the objects created by running the sample code, for example:
- workspaces
- documents
- choices
Note: The names of the objects created by sample code are set to a GUID using the TextIdentifier property.
- workspaces
- To delete the generated data, execute the teardown command in the console window.
Note: It is recommended to always delete the generated data after running the API samples.
Samples reference
The following table presents the categories of Relativity SDK samples, the corresponding classes in the samples solution, and the Services API operations that they illustrate.
Category | Class | Operations |
---|---|---|
Application Deployment System | SamplesLibrary.ApplicationDeploymentSystem |
|
Batch | SamplesLibrary.Repositories.BatchRepository |
|
BatchSet | SamplesLibrary.Repositories.BatchSetRepository |
|
Choice | SamplesLibrary.Repositories.ChoiceRepository |
|
Client |
SamplesLibrary.Repositories.ClientRepository SamplesLibrary.ServiceHost.Client SamplesLibrary.REST.ClientManager
|
ClientRepository (legacy pre-Relativity 9.0):
ServiceHost
REST
|
Document |
SamplesLibrary.Repositories.DocumentRepository SamplesLibrary.REST.Document |
DocumentRepository
REST
|
Error | SamplesLibrary.Repositories.ErrorRepository |
|
ExecuteBatch | SamplesLibrary.ExecuteBatch |
|
Field | SamplesLibrary.Repositories.FieldRepository |
|
FileField | SamplesLibrary.FileField |
|
Folder |
SamplesLibrary.Repositories.FolderRepository SamplesLibrary.REST.Folder |
FolderRepository
REST
|
Folder | ||
Group | SamplesLibrary.Repositories.GroupRepository |
|
KeywordSearchManager |
SamplesLibrary.ServiceHost.KeywordSearchManager SamplesLibrary.REST.KeywordSearchManager |
ServiceHost
REST
|
Layout | SamplesLibrary.Repositories.LayoutRepository |
|
MarkupSet | SamplesLibrary.Repositories.MarkupSetRepository |
|
MassAction | SamplesLibrary.MassAction |
|
Matter |
SampleLibrary.ServiceHost.Matter SampleLibrary.REST.Matter |
ServiceHost
REST
|
MOTD | SampleLibrary.ServiceHost.MOTD |
|
ObjectType | SamplesLibrary.Repositories.ObjectTypeRepository |
|
Permissions |
SampleLibrary.ServiceHost.Permissions SampleLibrary.REST.Permissions |
ServiceHost
REST
|
Pivot |
SampleLibrary.ServiceHost.PivotManager SampleLibrary.REST.Pivot |
ServiceManager
REST
|
RDO |
SamplesLibrary.Repositories.RDORepository SamplesLibrary.REST.RDO |
RDORepository
REST
|
RelativityApplication | SamplesLibrary.Repositories.RelativityApplicationRepository |
|
RelativityScript | SamplesLibrary.Repositories.RelativityScriptRepository |
|
RSAPIClient | SamplesLibrary.RSAPIClientSamples |
|
SavedSearch | SamplesLibrary.SearchProviders |
|
SearchContainer | SamplesLibrary.ServiceHost.SearchContainer |
ServiceHost
REST
|
Tab | SamplesLibrary.Repositories.TabRepository |
|
User | SamplesLibrary.Repositories.UserRepository |
|
User | SamplesLibrary.REST.User |
|
View | SamplesLibrary.Repositories.ViewRepository |
|
Workspace | SamplesLibrary.Repositories.WorkspaceRepository |
|
Workspace | SamplesLibrary.REST.Workspace |
|
BooleanConditionDocument |
SamplesLibrary.QuerySamples.BooleanCondition_Sample |
|
BooleanConditionRDO | SamplesLibrary.QuerySamples.BooleanCondition_Sample |
|
TextConditionDocument | SamplesLibrary.QuerySamples.TextCondition_Sample |
|
TextConditionRDO | SamplesLibrary.QuerySamples.TextCondition_Sample |
|
WholeNumberConditionDocument | SamplesLibrary.QuerySamples.WholeNumberCondition_Sample |
|
WholeNumberConditionDocumentRDO | SamplesLibrary.QuerySamples.WholeNumberCondition_Sample |
|
DecimalConditionDocument | SamplesLibrary.QuerySamples.DecimalCondition_Sample |
|
DecimalConditionRDO | SamplesLibrary.QuerySamples.DecimalCondition_Sample |
|
DateTimeConditionDocument | SamplesLibrary.QuerySamples.DateTimeCondition_Sample |
|
DateTimeConditionRDO | SamplesLibrary.QuerySamples.DateTimeCondition_Sample |
|
MultiLineStringCondition | SamplesLibrary.QuerySamples.MultiLineStringCondition_Sample |
|
ObjectsCondition | SamplesLibrary.QuerySamples.ObjectsCondition_Sample |
|
ObjectCondition | SamplesLibrary.QuerySamples.ObjectCondition_Sample |
|
FileCondition | SamplesLibrary.QuerySamples.FileCondition_Sample |
|
UserCondition | SamplesLibrary.QuerySamples.UserCondition_Sample |
|