Client Manager service
The Relativity REST API supports operations with the Client objects though the Client Manager service. The operations available through the service are equivalent to the asynchronous methods for interacting with the Client objects in the Relativity Services API. For more information, see Client in the Services API documentation.
Note: You can only use the POST method when interacting with the service.
This page contains the following information:
Sample code
The following is an example of .NET REST code for creating a Client. The code can be used for all Client Manager service operations with different endpoint URLs and input JSON values.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | //Set up the REST client. HttpClient httpClient = new HttpClient(); //Set the required headers. httpClient.DefaultRequestHeaders.Add( "X-CSRF-Header" , "-" ); httpClient.DefaultRequestHeaders.Add( "Authorization" , "Basic c2FtcGxlYWRtaW5AcmVsYXRpdml0eS5yZXN0OlMwbTNwQHNzdzByZA==" ); //Call Create for a Client. string url = "Relativity.REST/api/Relativity.Services.Client.IClientModule/Client%20Manager/CreateSingleAsync" ; StringContent content = new StringContent(CreateInputJSON, Encoding.UTF8, "application/json" ); HttpResponseMessage response = httpClient.PostAsync(url, content).Result; string result = response.Content.ReadAsStringAsync().Result; bool success = HttpStatusCode.Created == response.StatusCode; //Parse the result with Json.NET. JObject resultObject = JObject.Parse(result); |
A complete code sample of REST API operations on Client objects is included in the APISamples.sln solution in the Relativity SDK:
- kCura.Relativity.Client.SamplesLibrary.CS\REST\ClientManager.cs
For more information, see Relativity SDK samples.
Create
Use this Client Manager service URL to create a Client:
<host>/Relativity.REST/api/Relativity.Services.Client.IClientModule/Client%20Manager/CreateSingleAsync |
The request must include a valid JSON representation of a Client DTO. The required properties include Name, Number, and Status.
Note: You can only use the ArtifactID of the Choice to set the Client status value.
The response is an Artifact ID of the created Client.
Read
Use this Client Manager service URL to read a Client:
<host>/Relativity.REST/api/Relativity.Services.Client.IClientModule/Client%20Manager/ReadSingleAsync |
The request must include the Client Artifact ID.
1 2 3 | { "clientArtifactID" : 13759952 } |
The response returns a JSON representation of a Client DTO.
Update
Use this Client Manager service URL to update a Client:
<host>/Relativity.REST/api/Relativity.Services.Client.IClientModule/Client%20Manager/UpdateSingleAsync |
The request must include a valid JSON representation of a Client DTO.
Note: You must include all DTO field information in the update. You cannot update individual fields because fields left empty will be cleared on the update. All DTO fields are required except for system/user created by/created on.
The following JSON sample illustrates how to change the Name and Number properties of the Client created in a previous example.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | { "clientDTO" : { "Number" : "1234567-PD" , "Status" : { "ArtifactID" : 662, "Name" : "Active" , "Guids" : null }, "Keywords" : "" , "Notes" : "" , "ArtifactID" : 13759952, "Name" : "Updated Sample Client" } } |
The response does not contain any data. Success or failure are indicated by the HTTP status code. For more information, see HTTP status codes.
Delete
Use this Client Manager service URL to delete a Client:
<host>/Relativity.REST/api/Relativity.Services.Client.IClientModule/Client%20Manager/DeleteSingleAsync |
The request must include the Client ArtifactID.
1 2 3 | { "clientArtifactID" : 13759952 } |
The response does not contain any data. Success or failure are indicated by the HTTP status code. For more information, see HTTP status codes.
Query
The Client Manager service URL for querying Client:
<host>/Relativity.REST/api/Relativity.Services.Client.IClientModule/Client%20Manager/QueryAsync |
The request must include the query and optionally the number of results to return as the length property. The following is an example of a query for Clients with the name starting with 'API'. The result set is sorted by ArtifactID in descending order.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | { "query" : { "Condition" : "'Name' STARTSWITH 'API'" , "Sorts" : [ { "FieldIdentifier" : { "Name" : "ArtifactID" }, "Order" : 0, "Direction" : 1 } ] }, "length" : 5 } |
If more results are available than initially specified in the length property, the query returns a token value that is not null. The results can subsequently be retrieved by a call to the QuerySubsetAsync operation.
<host>/Relativity.REST/api/Relativity.Services.Client.IClientModule/Client%20Manager/QuerySubsetAsync |
Note that the QuerySubsetAsync request can specify the starting index of the result subset and the number of results to be returned.
1 2 3 4 5 | { "queryToken" : "a5079c32-e080-473d-846e-941ef6a5f086" , "start" : 6, "length" : 5 } |
To return all Clients in a Relativity instance, specify an empty Condition as shown in the JSON example below. When the length parameter is not specified, its value defaults to 0, and the number of returned results defaults to the Instance setting table value of PDVDefaultQueryCacheSize of 10000. For more information, see Search Relativity.
1 2 3 | { "query" :{} } |
The response returns a collection of Client objects as a ClientQueryResultSet object.
Get status choices
Use this Client Manager service URL for return the choices for the Client status field:
<host>/Relativity.REST/api/Relativity.Services.Client.IClientModule/Client%20Manager/GetStatusChoicesForClientAsync |
The request does not include any parameters.
The response returns a collection of Choice objects.
1 2 3 4 5 6 7 8 9 10 11 12 | [ { "ArtifactID" : 662, "Name" : "Active" , "Guids" : [] }, { "ArtifactID" : 669, "Name" : "Inactive" , "Guids" : [] } ] |