Document File Manager service

Through the REST API, the Document File Manager API exposes endpoints for downloading native, image, and produced image files associated with documents in Relativity. You can download a file by specifying its GUID, or you can download a native file by specifying the Artifact ID of the document associated with it. The Document File Manager API also supports retrieving information about these files, such as GUID, name, type, size, and others.

Sample use cases for the Document File Manager API include the implementing the following functionality:

  • A custom agent that downloads native audio files, transcribes them, and writes the text back to Relativity.
  • A custom page that displays the names, sizes, and types for a subset of documents.

The Document File Manager API supports the same functionality for this service as available through the REST API. For more information, see Document File Manager API.

This page contains the following information:

Client code sample

To use the Document File Manager service, send requests by making calls with the required HTTP methods. See the following base URL for this service:

<host>/Relativity.REST/api/Relativity.Document/workspace/{{workspaceID}}/

You can use the following .NET code as a sample client for downloading a native file. This code illustrates how to perform the following tasks:

  • Instantiate an HttpClient object for sending requests to the Document File Manager service.
  • Set the required headers for the request. For information on setting headers, see HTTP headers.
  • Initialize variables with the values for the workspace and document Artifact IDs.
  • Set the url variable to the URL for downloading a native file. For more information, see Download a native file by Document Artifact ID.
  • Use the GetAsync() method to send a GET request.
  • Return the results of the request as a Stream object.
  • Save the file on disk using the file name specified in the ContentDisposition header.
public static async Task DownloadAndSaveFileHttpExample()
{
    using (HttpClient client = new HttpClient())
    {
        client.DefaultRequestHeaders.Add("X-CSRF-Header", "-");
        client.DefaultRequestHeaders.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes("test@test.com:SomePassword!")));
        client.DefaultRequestHeaders.Add("X-Kepler-Version", "2.0");
        client.BaseAddress = new Uri("https://localhost");

        int workspaceId = 1016883;
        int documentArtifactId = 1038029;

        string url = $"/Relativity.REST/api/Relativity.Document/workspace/{workspaceId}/downloadnativefile/{documentArtifactId}";
        using (HttpResponseMessage response = await client.GetAsync(url))
        {
            response.EnsureSuccessStatusCode();
            using (Stream responseStream = await response.Content.ReadAsStreamAsync())
            using (Stream fileStream = File.Create($"C:\\RelativityDocuments\\{(response.Content.Headers.ContentDisposition.FileName).Replace("\"", "")}"))
            {
                await responseStream.CopyToAsync(fileStream);
            }
        }
    }
}

Retrieve document file information

You can retrieve information about the files associated with a document, including the file name, GUID, page orientation and others.

Note: To retrieve the file information for a document, you must have rights to view it in the workspace. Additionally, you must have access rights to view a production for its associated files to be include in the results.

Send a GET request using the following URL format:

<host>/Relativity.REST/api/Relativity.Document/workspace/{{workspaceID}}/fileinfo/{{documentID}}

Set the {{workspaceID}} to the Artifact ID of the workspace containing the document, and the {{documentID}} to the Artifact ID of the document. See the following sample URL:

<host>/Relativity.REST/api/Relativity.Document/workspace/1016883/fileinfo/1038018

The body of the request is empty.

The response contains an array of the DocumentFile objects. Each object has the following fields:

  • Guid - a unique universal identifier for the file.
  • Filename - the name of the file.
  • Identifier - - a unique string used to identify the file. The following sample JSON doesn't include this field.
  • Order - an integer value indicating the position of a file in a set of files with the same file type. Only OriginalImage and ProducedImage file types have a non-zero value for this field.
  • FileType - the type of the file. The following list includes valid values for this field:
    • Native
    • OriginalImage
    • ProducedImage

    For more information, see the DocumentFileType enumeration in the Relativity.Services.Interfaces.Document.Models Namespace namespace in the Relativity API reference.

  • Size - the size of the file in bytes.
  • Rotation - the orientation used to display the file. This property is only set for OriginalImage and ProducedImage files. The following list includes valid values for this field:
    • NotSet
    • ZeroDegrees
    • NinetyDegrees
    • OneHundredEightyDegrees
    • TwoHundredSeventyDegrees

    For more information, see the DocumentFileRotation enumeration in the Relativity.Services.Interfaces.Document.Models Namespace namespace in the Relativity API reference.

[
  {
    "Guid": "d52141e9-8144-47af-b2f9-635045c313fc",
    "Filename": "MyDocument.docx",
    "Order": 0,
    "FileType": "Native",
    "Size": 20912,
    "Rotation": "NotSet"
  },
  {
    "Guid": "e03a9a5f-e398-46b2-a7d0-4c3ec1cd4541",
    "Filename": "MyDocument.tif",
    "Order": 0,
    "FileType": "OriginalImage",
    "Size": 944,
    "Rotation": "NinentyDegrees"
  },
  {
    "Guid": "21d33e10-6034-468e-ac2d-7f57c16e589f",
    "Filename": "MyDocument_001.tif",
    "Order": 1,
    "FileType": "OriginalImage",
    "Size": 650,
    "Rotation": "TwoHundredSeventyDegrees"
  }
]

Download files

You can download native, image, and produced image files associated with documents in Relativity using the following endpoints:

These endpoints return the binary data of a file. The response contains these headers with the following settings:

  • Transfer-Encoding - this heading is set to chunked.
  • Content-Type - the extension of the file determines the value of this header.
  • Content-Disposition - the name of the file as defined within Relativity determines the filename in attachment; filename=.

Note: For native and image files, you must have rights to the document in the workspace. For produced image files, you must have rights to both the document and the production that includes the produced images.

Download a file by GUID

You can download a native, image, or produced image file by specifying its GUID in a call to the DownloadFile endpoint. To obtain the GUID of a file for download, use the GetFileInfo endpoint. See Retrieve document file information.

Send a GET request using the following URL format:

<host>/Relativity.REST/api/Relativity.Document/workspace/{{workspaceID}}/downloadfile/{{fileGuid}}

Set the {{workspaceID}} to the Artifact ID of the workspace containing the document, and the {{fileGuid}} to the GUID for the file. See the following sample URL:

<host>/Relativity.REST/api/Relativity.Document/workspace/1016883/downloadfile/d6d94ed0-c46b-427d-b702-2682f1e43cf5

When the request is successful, the response returns the status code of 200, and the file is saved to disk using the file name specified in the Content-Disposition header.

Download a native file by Document Artifact ID

You can download a native file by specifying the Artifact ID of the document associated with it. This convenience endpoint functions similarly to calling the DownloadFile endpoint with the GUID for a native file, except that you specify the Artifact ID of a document.

Send a GET request using the following URL format:

<host>/Relativity.REST/api/Relativity.Document/workspace/{{workspaceID}}/downloadnativefile/{{documentID}}

Set the {{workspaceID}} to the Artifact ID of the workspace containing the document, and the {{documentID}} to the Artifact ID of the document. See the following sample URL:

<host>/Relativity.REST/api/Relativity.Document/workspace/1016883/downloadnativefile/1038018

When the request is successful, the response returns the status code of 200, and the file is saved to disk using the file name specified in the Content-Disposition header.