Relativity Services API (RSAPI) DTOs have been deprecated and are no longer supported. For more information and alternative APIs, see RSAPI deprecation process.

Retrieve resources

You can use the GET method to retrieve the default properties on a single resource or a collection of resources. A GET request can also include a query string with a list of specific fields that you want returned. It's recommended that you limit the maximum number of fields in a query string to 30. The browser truncates the query when the supported string length is exceeded, so additional fields are ignored.

By setting paging parameters, you can use the returned token in multiple GET requests to retrieve consecutive pages that contain lists of objects or fields. The result page contains a link to the next page of results. See Paging.

Note: The REST API also uses the POST method to support queries. See Query for resources.

The following code exemplifies how to retrieve a resource, such as a workspace. Depending on your environment configuration, you need to update the URI used for the BaseAddress, and the URL used to retrieve the workspace in the example. For more information, see Workspaces.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//Set up the client.
             
HttpClient httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("http://localhost/");
  
//Set the required headers.
httpClient.DefaultRequestHeaders.Add("X-CSRF-Header", string.Empty);
httpClient.DefaultRequestHeaders.Add("Authorization", "Basic c2FtcGxlYWRtaW5AcmVsYXRpdml0eS5yZXN0OlMwbTNwQHNzdzByZA==");
  
//Call the GET method on a Workspace.
string url = "Relativity.REST/Relativity/Workspace/1015349";
HttpResponseMessage response = httpClient.GetAsync(url).Result;
string result = response.Content.ReadAsStringAsync().Result;
bool success = HttpStatusCode.OK == response.StatusCode;
  
//Parse the result with Json.NET.
             
JObject resultObject = JObject.Parse(result);

Retrieve a resource

You can use the GET method to retrieve a single resource. The following URLs provide examples of how to retrieve a single Relativity resource.

  • Admin choice with ArtifactID of 780
      http://localhost/Relativity.REST/Relativity/780
  • Choice - retrieves all Fields for a Single Choice field with ArtifactID of 1038055 in Workspace 1338504.
      http://localhost/Relativity.REST/Workspace/1338504/Field/1038055
  • Document
      http://localhost/Relativity.REST/Workspace/1015349/Document/1038579
  • RDO
      http://localhost/Relativity.REST/Workspace/1015349/Example%20RDO/1041611
  • User
      http://localhost/Relativity.REST/Relativity/User/1015314
  • Workspace
      http://localhost/Relativity.REST/Relativity/Workspace/1015349

Retrieve multiple resources

You can use the GET method to retrieve a multiple resources. The following URLs provide examples of how to retrieve a collection of Relativity resources.

  • Document collection
      http://localhost/Relativity.REST/Workspace/1015349/Document
  • RDO collection
      http://localhost/Relativity.REST/Workspace/1015349/Example%20RDO
  • User collection
      http://localhost/Relativity.REST/Relativity/User
  • Workspace collection
      http://localhost/Relativity.REST/Relativity/Workspace
  • Admin choice collection
      http://localhost/Relativity.REST/Relativity/Choice

Retrieve specific Fields on objects

You can use the GET method to retrieve fields on admin or workspace-level objects, as well as on a single resource or collection of resources.

To return all default properties of an Artifact, don't specify any parameters in the URL. You can retrieve specific fields by adding the parameter fields to the query string, and setting it equal to a value. You can add any number of fields by appending &fields=Field+Name to a URL. The parameter fields is case insensitive and the plus sign (+) represents a space. See the following sample URLs for retrieving fields:

  • Fields on a Document
      http://localhost/Relativity.REST/Workspace/1015054/Document?fields=Extracted+Text&Fields=System+Created+By
  • Fields on Single Choice field with ArtifactID 1038055
      http://localhost/Relativity.REST/Workspace/1338504/Field/1038055?fields=Name&fields=Choices
  • Fields on a User
      http://localhost/Relativity.REST/Relativity/User/9?fields=First+Name&fields=Last+Name
  • Fields on a collection of Workspaces
      http://localhost/Relativity.REST/Relativity/Workspace?fields=System+Created+By