Document Viewer Services (REST)

The Document Viewer Services API provides functionality for requesting the conversion of documents to viewer types supported by Relativity, such as native, image, production, and transcript types. You can also convert files contained in File fields on a Relativity Dynamic Objects (RDOs). These files are converted to their native format on the fly, and then displayed in the standalone viewer.

The following sample use cases illustrate how you can use these cache entries to create custom viewers or workflows for displaying documents:

  • Convert documents and save their locations in the cache. Next, create a custom application that retrieves native documents and displays them in a user-friendly format through a browser.
  • Create a custom page or workflow that requests a document on the fly for immediate display in the viewer. Send a notification when the document is converted and available for viewing.

You can also use the Document Viewer Services through .NET. For more information, see Document Viewer Services (.NET).

This page contains the following information:

Guidelines for using the Document Viewer Services

Review the following guidelines for working with the Document Viewer Services.

URLs

The URLs for REST endpoints contain path parameters that you need to set before making a call:

  • Set {versionNumber} to the version of the API, using the format lowercase v and the version number, such as v2.
  • Set other path parameters in the URLs to the Artifact ID of a given entity as necessary.

For example, you can use the following URL to convert documents in a workspace:

<host>Relativity.REST/api/relativity-documentViewer/{versionNumber}/viewer-content-key

Set the path parameter as follows:

  • {versionNumber} to the version of the service, such as v2.

For more information about this endpoint, see Convert documents.

Client code samples

To use the Document Viewer Services, send a POST request to a URL with the following format:

<host>Relativity.REST/api/relativity-documentViewer/{versionNumber}/viewer-content-key

The viewer-content-key endpoint supports different conversion types and priorities. You can use the following .NET code samples as REST clients for requesting conversions. They illustrate how to perform conversions for native formats, productions, and images with various priorities. Additionally, they all perform the following common tasks:

  • Instantiate an HttpClient object for sending requests and responses using the URL for the Document Viewer Service.
  • Set the required headers for the request.
  • Set the BaseAddress variable to the Host Url.
  • Set the string represented by parameters variable to the JSON input required to request a conversion.
  • Use Newtonsoft to serialize the request object into JSON.
  • Use the PostAsync() method to send a post request.
  • Return the results of the request and deserialize it.

Convert documents

To convert documents in a workspace, send a POST request to a URL with the following format:

<host>Relativity.REST/api/relativity-documentViewer/{versionNumber}/viewer-content-key

Convert files contained in File fields on RDOs

You can convert a file contained in a File field on a Relativity Dynamic Object (RDO) for display in the standalone viewer. This file is converted to its native format. Like document conversion, this process uses the viewer-content-key endpoint.

Send a POST request to a URL with the following format:

<host>Relativity.REST/api/relativity-documentViewer/{versionNumber}/viewer-content-key

The JSON responses for converting File fields contain the same fields as those returned for document conversion. See View sample JSON responses.