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.

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.

  1. Open the APISamples solution in Visual Studio.
    C:\Program Files\kCura Corporation\Relativity SDK\Services API\kCura.Relativity.Client.APISamples\APISamples.sln
  2. Specify the Relativity credentials for running the samples in the following app.config files:
    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.

    <?xml version="1.0"?>
    <configuration>
    	<appSettings>
    		<add key="ServerID" value="1015096"/>
    		<add key="Username" value="relativity.admin@kcura.com"/>
    		<add key="Password" value="YourPasswordGoesHere"/>
    		<add key="BaseAddress" value="https://localhost"/>
    	</appSettings>
    	<startup>
    		<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
    	</startup>
    </configuration>
    
  3. Set kCura.Relativity.Client.SamplesLibrary.Runner as the startup project.
  4. (Optional) Set the logging level on the Debug Page of the Visual Studio Project Designer.

    Valid values include:

    --debug

    --warning

    --error

  5. Run the solution and follow the instructions in the console window.
  6. Press any key to set up sample data.
  7. 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, you will a new workspace with a list of documents and choices.

    Note: The names of the objects created by sample code are set to a GUID using the TextIdentifier property.

  8. 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
  • import an application
  • export an application
  • push a resource file
  • update a custom page
Batch SamplesLibrary.Repositories.BatchRepository
  • update a batch
  • query batches
BatchSet SamplesLibrary.Repositories.BatchSetRepository
  • create a batch set
  • update a batch set
  • delete a batch set
  • create batches for batch set
  • cancel batch creation
  • purge batches in a batch set
Choice SamplesLibrary.Repositories.ChoiceRepository
  • create an admin choice
  • create a workspace choice
  • create a batch of workspace choices
  • read a batch of workspace choices
  • read an admin choice
  • read a workspace choice
  • update a workspace choice
  • delete a batch of admin choices
  • delete a workspace choice
  • query workspaces choices
  • query admin choices
Client

SamplesLibrary.Repositories.ClientRepository

SamplesLibrary.ServiceHost.Client

SamplesLibrary.REST.ClientManager

 

ClientRepository (legacy pre-Relativity 9.0):

  • create a client
  • read a client
  • update a client
  • delete a client
  • query a client

 

ServiceHost

  • create a client
  • read a client
  • update a client
  • delete a client
  • query a client
  • get status choices

 

REST

  • create a client
  • read a client
  • update a client
  • delete a client
  • query a client
  • get status choices
Document

SamplesLibrary.Repositories.DocumentRepository

SamplesLibrary.REST.Document

DocumentRepository

  • create a batch of documents
  • create a document
  • read a batch of documents
  • read a document
  • update a document
  • delete a document
  • query a document by artifact ID
  • query a document with a relational field
  • query documents by subset
  • query a document by extracted text
  • download document native

 

REST

  • create a single document
  • read a batch of documents
  • read a document
  • update a document
  • delete a document
  • query a document
Error SamplesLibrary.Repositories.ErrorRepository
  • create an error
ExecuteBatch SamplesLibrary.ExecuteBatch
  • execute batch
Field SamplesLibrary.Repositories.FieldRepository
  • create a field
  • read a field
  • delete a field
  • query a field
FileField SamplesLibrary.FileField
  • populate file field
  • download from file field
  • clear file field
Folder

SamplesLibrary.Repositories.FolderRepository

SamplesLibrary.REST.Folder

FolderRepository

  • create a folder
  • read a folder
  • delete a folder
  • query a folder

 

REST

  • create a folder
Folder  
Group SamplesLibrary.Repositories.GroupRepository
  • create a group
  • read a group
  • update a group
  • delete a group
  • query a group
KeywordSearchManager

SamplesLibrary.ServiceHost.KeywordSearchManager

SamplesLibrary.REST.KeywordSearchManager

ServiceHost

  • query a keyword search
  • create a keyword search
  • read a keyword search
  • update a keyword search
  • delete a keyword search
  • get email link URL for a keyword search
  • keyword search helper methods

 

REST

  • query a keyword search
  • create a keyword search
  • create a keyword search - text condition
  • create a keyword search - multiple conditions
  • create a keyword search - nested conditions
  • create a keyword search - date condition
  • read a keyword search
  • update a keyword search
  • delete a keyword search

 

Layout SamplesLibrary.Repositories.LayoutRepository
  • read a layout
  • query layouts
MarkupSet SamplesLibrary.Repositories.MarkupSetRepository
  • create a markup set
  • read a markup set
  • update a markup set
  • delete a markup set
  • query a markup set
MassAction SamplesLibrary.MassAction
  • mass edit
  • mass create
  • mass create with details
  • mass delete delete all bjects of specific type in workspace
  • mass delete to cascade and force delete all documents in workspace
  • mass delete to cascade delete specific objects of specific type
  • mass delete to force delete images for specific documents
Matter

SampleLibrary.ServiceHost.Matter

SampleLibrary.REST.Matter

ServiceHost

  • create a matter
  • read a matter
  • update a matter
  • delete a matter
  • query a matter
  • get status choices
  • get clients

 

REST

  • create a matter
  • read a matter
  • update a matter
  • delete a matter
  • query a matter
  • get status choices
  • get clients
MOTD SampleLibrary.ServiceHost.MOTD
  • read a MotD
  • update a MotD
ObjectType SamplesLibrary.Repositories.ObjectTypeRepository
  • create an object type
  • read an object type
  • update an object type
  • delete an object type
  • query an object type
Permissions

SampleLibrary.ServiceHost.Permissions

SampleLibrary.REST.Permissions

ServiceHost

  • get admin group selector
  • add/remove admin groups
  • get workspace group selector
  • add/remove workspace groups
  • get item group selector
  • add/remove item groups
  • get admin group permissions
  • set admin group permissions
  • get workspace group permissions
  • set workspace group permissions
  • get item group permissions
  • set item group permissions
  • get item level security
  • set item level security
  • get admin group users
  • get workspace group users
  • get item group users
  • query permissions
  • read a permission
  • create a permission
  • update a permission
  • delete a permission
  • get selected permissions
  • get selected permissions for a group
  • set selected permissions for a group

 

REST

  • get admin group selector
  • add/remove admin groups
  • get workspace group selector
  • add/remove workspace groups
  • get item group selector
  • add/remove item groups
  • get admin group permissions
  • set admin group permissions
  • get workspace group permissions
  • set workspace group permissions
  • get item group permissions
  • set item group permissions
  • get item level security
  • set item level security
  • get admin group users
  • get workspace group users
  • get item group users
  • query permissions
  • read a permission
  • create a permission
  • update a permission
  • delete a permission
  • get selected permissions
  • get selected permissions for a group
  • set selected permissions for a group
Pivot

SampleLibrary.ServiceHost.PivotManager

SampleLibrary.REST.Pivot

ServiceManager

  • run a custom Pivot query
  • run a query based on a Pivot profile
  • get fields to group by
  • get fields to pivot on

 

REST

  • run a custom Pivot query
  • run a query based on a Pivot profile
  • get fields to group by
  • get fields to pivot on

 

RDO

SamplesLibrary.Repositories.RDORepository

SamplesLibrary.REST.RDO

RDORepository

  • create a batch of RDOs
  • create an RDO
  • read a batch of RDOs
  • read an RDO
  • update an RDO
  • delete an RDO
  • query an RDO
  • get file download URL

 

REST

  • create an RDO
  • read a batch of RDOs
  • read an RDO
  • read an RDO field
  • update an RDO
  • delete an RDO
  • query an RDO

 

RelativityApplication SamplesLibrary.Repositories.RelativityApplicationRepository
  • read a Relativity application
  • delete a Relativity application
  • query Relativity applications
RelativityScript SamplesLibrary.Repositories.RelativityScriptRepository
  • get Relativity script inputs
  • read a Relativity script
  • query Relativity scripts
  • ConvertToScriptInputList
RSAPIClient SamplesLibrary.RSAPIClientSamples
  • log in
  • generate Relativity authentication token
  • create a Services API client and log in with UsernamePassword authentication
  • create a Services API client and log in with integrated Windows authentication
SavedSearch SamplesLibrary.SearchProviders
  • analytics search
  • dtSearch
  • keyword search
SearchContainer SamplesLibrary.ServiceHost.SearchContainer

ServiceHost

  • create a saved search folder
  • read a saved search folder
  • update a saved search folder
  • delete a saved search folder
  • query a saved search folder
  • get items in a saved search folder

 

REST

  • create a saved search folder
  • read a saved search folder
  • update a saved search folder
  • delete a saved search folder
  • query a saved search folder
  • get items in a saved search folder
Tab SamplesLibrary.Repositories.TabRepository
  • read a tab
  • query tabs
User SamplesLibrary.Repositories.UserRepository
  • create a user
  • read a user
  • update a user
  • delete a user
  • query users
User SamplesLibrary.REST.User
  • create a user
  • read a user
  • read a batch of users
  • update a user
  • delete a user
  • query users
  • query users - advanced
View SamplesLibrary.Repositories.ViewRepository
  • read a view
  • query a view
  • execute a view - fields
  • execute a view - documents
Workspace SamplesLibrary.Repositories.WorkspaceRepository
  • create a workspace
  • read a single workspace
  • read multiple workspaces
  • update a workspace
  • delete a workspace
  • query workspaces by Artifact ID
  • query workspaces by name
Workspace SamplesLibrary.REST.Workspace
  • read a workspace
  • read a batch of workspaces
  • query workspaces

BooleanConditionDocument

SamplesLibrary.QuerySamples.BooleanCondition_Sample
  • BooleanCondition.EqualTo
  • BooleanCondition.IsSet
BooleanConditionRDO SamplesLibrary.QuerySamples.BooleanCondition_Sample
  • BooleanCondition.EqualTo
  • BooleanCondition.IsSet
TextConditionDocument SamplesLibrary.QuerySamples.TextCondition_Sample
  • TextCondition.EqualTo
  • TextCondition.IsSet
  • TextCondition.Like
  • TextCondition.StartsWith
  • TextCondition.EndsWith
  • TextCondition.In
TextConditionRDO SamplesLibrary.QuerySamples.TextCondition_Sample
  • TextCondition.EqualTo
  • TextCondition.IsSet
  • TextCondition.Like
  • TextCondition.StartsWith
  • TextCondition.EndsWith
  • TextCondition.In
WholeNumberConditionDocument SamplesLibrary.QuerySamples.WholeNumberCondition_Sample
  • WholeNumberCondition.EqualTo
  • WholeNumberCondition.GreaterThan
  • WholeNumberCondition.LessThan
  • WholeNumberCondition.GreaterThanOrEqualTo
  • WholeNumberCondition.LessThanOrEqualTo
  • WholeNumberCondition.IsSet
  • WholeNumberCondition.In
WholeNumberConditionDocumentRDO SamplesLibrary.QuerySamples.WholeNumberCondition_Sample
  • WholeNumberCondition.EqualTo
  • WholeNumberCondition.GreaterThan
  • WholeNumberCondition.LessThan
  • WholeNumberCondition.GreaterThanOrEqualTo
  • WholeNumberCondition.LessThanOrEqualTo
  • WholeNumberCondition.IsSet
  • WholeNumberCondition.In
DecimalConditionDocument SamplesLibrary.QuerySamples.DecimalCondition_Sample
  • DecimalCondition.EqualTo
  • DecimalCondition.GreaterThan
  • DeciamlCondition.LessThan
  • DecimalCondition.GreaterThanOrEqualTo
  • DecimalCondition.LessThanOrEqualTo
  • DecimalCondition.IsSet
  • DecimalCondition.In
DecimalConditionRDO SamplesLibrary.QuerySamples.DecimalCondition_Sample
  • DecimalCondition.EqualTo
  • DecimalCondition.GreaterThan
  • DeciamlCondition.LessThan
  • DecimalCondition.GreaterThanOrEqualTo
  • DecimalCondition.LessThanOrEqualTo
  • DecimalCondition.IsSet
  • DecimalCondition.In
DateTimeConditionDocument SamplesLibrary.QuerySamples.DateTimeCondition_Sample
  • DateTimeCondition.EqualTo
  • DateTimeCondition.GreaterThan
  • DateTimeCondition.LessThan
  • DateTimeCondition.GreaterThanOrEqualTo
  • DateTimeCondition.LessThanOrEqualTo
  • DateTimeCondition.Between
  • DateTimeCondition.IsSet
DateTimeConditionRDO SamplesLibrary.QuerySamples.DateTimeCondition_Sample
  • DateTimeCondition.EqualTo
  • DateTimeCondition.GreaterThan
  • DateTimeCondition.LessThan
  • DateTimeCondition.GreaterThanOrEqualTo
  • DateTimeCondition.LessThanOrEqualTo
  • DateTimeCondition.Between
  • DateTimeCondition.IsSet
MultiLineStringCondition SamplesLibrary.QuerySamples.MultiLineStringCondition_Sample
  • MultiLineStringCondition.EqualTo
  • MultiLineStringCondition.Like
  • MultiLineStringCondition.IsSet
  • MultiLineStringCondition.StartsWith
  • MultiLineStringCondition.EndsWith
  • MultiLineStringCondition.In
ObjectsCondition SamplesLibrary.QuerySamples.ObjectsCondition_Sample
  • ObjectsCondition.AllOfThese
  • ObjectsCondition.AnyOfThese
  • ObjectsCondition.IsSet
ObjectCondition SamplesLibrary.QuerySamples.ObjectCondition_Sample
  • ObjectCondition.EqualTo
  • ObjectCondition.AnyOfThese
  • ObjectCondition.IsSet
FileCondition SamplesLibrary.QuerySamples.FileCondition_Sample
  • FileCondition.IsSet
UserCondition SamplesLibrary.QuerySamples.UserCondition_Sample
  • UserCondition.IsSet
  • UserCondition.EndsWith
  • UserCondition.EqualTo
  • UserCondition.Like
  • UserCondition.StartsWith

Additional Resources

DevHelp Community GitHub Release Notes NuGet

Share knowledge with the Relativity developer community.

Access tools and resources to build an application.

Review the most recent product release notes.

Create .NET Apps faster with NuGet.