This DTO has been deprecated as part of the Relativity Services API (RSAPI) Deprecation and is no longer supported. For more information and alternative APIs, see RSAPI deprecation process.

Document

A Document resource represents a Relativity object with properties such as native files, extracted text, images, and other metadata. It is a workspace-level resource.

This page contains the following information:

GET method

You can use the GET method to retrieve a single Document or a collection of Documents. You can find a general overview of this functionality in Retrieve resources.

Retrieving a Document

When you retrieve a single Document, you must supply a unique identifier (such as a GUID or ArtifactID) for the resource.

Sample URL

The URL contains the identifier for a Document resource. You don't need to provide a body with a GET request.

/localhost/Relativity.REST/Workspace/1015349/Document/1038579
        

Code sample

//Set up the client.
            
HttpClient httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("http://localhost/");
 
//Set the required headers.
httpClient.DefaultRequestHeaders.Add("X-CSRF-Header", "-");
httpClient.DefaultRequestHeaders.Add("Authorization", "Basic c2FtcGxlYWRtaW5AcmVsYXRpdml0eS5yZXN0OlMwbTNwQHNzdzByZA==");
 
//Call the GET method on a Document.
string url = "Relativity.REST/Workspace/1015349/Document/1038579";
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);
        

Response

Retrieve a collection of Documents

You can retrieve a collection of Documents with a GET method.

Sample URL

The URL indicates that you are retrieving a collection of Document resources. You don't need to provide a body with this GET request.

/localhost/Relativity.REST/Workspace/1015349/Document        

Code sample

//Set up the client.
            
HttpClient httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("http://localhost/");
 
//Set the required headers.
            
httpClient.DefaultRequestHeaders.Add("X-CSRF-Header", "-");
httpClient.DefaultRequestHeaders.Add("Authorization", "Basic c2FtcGxlYWRtaW5AcmVsYXRpdml0eS5yZXN0OlMwbTNwQHNzdzByZA==");
 
//Call the GET method on the Document collection.
            
string url = "Relativity.REST/Workspace/1015349/Document";
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);        

Response

POST method

You can use the POST method to perform complex queries or to create resources. For more information, see Perform queries and Create resources.

Query for a Document resource

You can set conditions used to query for a Document resource.

Sample URL

/localhost/Relativity.REST/Workspace/1017955/Document/QueryResult
        

Code sample

//Set up the client.
            
HttpClient httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("http://localhost/");
 
//Set the required headers.
httpClient.DefaultRequestHeaders.Add("X-CSRF-Header", "-");
httpClient.DefaultRequestHeaders.Add("Authorization", "Basic bXkudXNlckBrY3VyYS5jb206Q250VGNoVGhzMTIzNCE=");
 
//Call query on a Document.
            
string url = string.Format("Relativity.REST/Workspace/{0}/Document/QueryResult", 1017955);
StringContent content = new StringContent(QueryInputJSON);
content.Headers.ContentType = new MediaTypeHeaderValue("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);
        

Request

Response

Create a document resource

You can create a Document with the POST method. For more information, see Create resources.

Sample URL

/localhost/Relativity.REST/Workspace/1015349/Document        

Code sample

using (HttpClient httpClient = new HttpClient())
{
    // Set up the client.
    httpClient.BaseAddress = new Uri("http://localhost/");

    // Set the required headers.
    httpClient.DefaultRequestHeaders.Add("X-CSRF-Header", "-");
    httpClient.DefaultRequestHeaders.Add("Authorization", "Basic c2FtcGxlYWRtaW5AcmVsYXRpdml0eS5yZXN0OlMwbTNwQHNzdzByZA==");

    // Call the POST method on a Document.
    string url = "Relativity.REST/Workspace/1015349/Document";

    // using Newtonsoft.Json.Linq;
    // for JSON creation
    JObject payload = new JObject
    {
        { "Artifact Type Name", "Document" },
        { "Doc ID Beg", "MOON_001" },
        { "Parent Artifact", new JObject
            {
                { "Artifact ID", 1003697 }
            }
        },
        { "Relativity Native File Location", @"\\share\file.txt" }
    };
    string createInputJSON = payload.ToString();

    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.
    JObject resultObject = JObject.Parse(result);
}

Request

Response

PUT method

You can use the PUT method to update properties on a Document. For more information, see Create and update resources.

Sample URL

/localhost/Relativity.REST/Workspace/1015349/Document/1038579        

Code sample

//Set up the client.
            
HttpClient httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("http://localhost/");
 
//Set the required headers.
httpClient.DefaultRequestHeaders.Add("X-CSRF-Header", "-");
httpClient.DefaultRequestHeaders.Add("Authorization", "Basic c2FtcGxlYWRtaW5AcmVsYXRpdml0eS5yZXN0OlMwbTNwQHNzdzByZA==");
 
//Call the PUT method on a Document.
string url = "Relativity.REST/Workspace/1015349/Document/1038579";
StringContent content = new StringContent(UpdateInputJSON, Encoding.UTF8, "application/json");
HttpResponseMessage response = httpClient.PutAsync(url, content).Result;
string result = response.Content.ReadAsStringAsync().Result;
bool success = HttpStatusCode.OK == response.StatusCode;
 
//Parse the result with Json.NET.
JObject resultObject = JObject.Parse(result);        

Request

Response

DELETE method

You can use the Delete method to remove a Document from the database. You don't need to provide a body with a DELETE request.

Sample URL

/localhost/Relativity.REST/Workspace/1015349/Document/1038579        

Code sample

//Set up the client.
            
HttpClient httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("http://localhost/");
 
//Set the required headers.
            
httpClient.DefaultRequestHeaders.Add("X-CSRF-Header", "-");
httpClient.DefaultRequestHeaders.Add("Authorization", "Basic c2FtcGxlYWRtaW5AcmVsYXRpdml0eS5yZXN0OlMwbTNwQHNzdzByZA==");
 
//Call the DELETE method on a Document.
string url = "Relativity.REST/Workspace/1015349/Document/1038579";
HttpResponseMessage response = httpClient.DeleteAsync(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);        

Response

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.