In the REST API, the View Manager service provides endpoints for creating, reading, and updating views. It also provides endpoints for retrieving the following information:
You can use the View Manager service to add or modify views used in a custom application or through the Relativity UI. For example, you might want to create a view that uses a specific set of search criteria to display custom objects in an application.
The Relativity Services API also provides functionality for managing views. For more information, see View Manager (.NET).
This page contains the following information:
You can use the View Manager service by sending an HTTP request that makes a POST method call. See the following base URL for this service:
<host>/Relativity.Rest/API/Relativity.Services.View.IViewModule/View%20Manager/
You can use the following .NET code as a REST client for making calls with the View Manager service. This code illustrates how to perform the following tasks:
For information about running this code sample, see Relativity SDK samples.
public async Task<bool> ReadSingleAsync(IHelper helper) { bool success = false; using (IViewManager proxy = helper.GetServicesManager().CreateProxy<IViewManager>(ExecutionIdentity.User)) { int? viewToReadArtifactID; if (ViewHelper.TryCreate(proxy, this.SampleWorkspace_ID, "My View to Read", out viewToReadArtifactID)) { Logging.ISampleLogger logger = _logger.ForContext("MethodName", new StackFrame(0).GetMethod().Name, false); string username = ConfigurationManager.AppSettings["Username"].ToString(); string password = ConfigurationManager.AppSettings["Password"].ToString(); string base64header = helper.GetServicesManager().GetBase64Header(username, password); string baseAddress = ConfigurationManager.AppSettings["BaseAddress"].ToString(); string inputJSON = $@"{{ ""workspaceArtifactID"": {this.SampleWorkspace_ID}, ""viewArtifactID"": {viewToReadArtifactID} }}"; // Set up the client. HttpClient httpClient = new HttpClient(); httpClient.BaseAddress = new Uri(string.Format("{0}/", baseAddress)); // Set the required headers. httpClient.DefaultRequestHeaders.Add("X-CSRF-Header", "-"); httpClient.DefaultRequestHeaders.Add("Authorization", base64header); // Call the POST method string url = "/Relativity.REST/api/Relativity.Services.View.IViewModule/View%20Manager/ReadSingleAsync"; StringContent content = new StringContent(inputJSON, Encoding.UTF8, "application/json"); HttpResponseMessage response = await httpClient.PostAsync(url, content); string result = await response.Content.ReadAsStringAsync(); success = HttpStatusCode.OK == response.StatusCode; if (success) { // Parse the result with Json.NET JObject resultObject = JObject.Parse(result); int artifactID = 0; string name = string.Empty; JToken artifactIDToken; JToken nameToken; if (resultObject.TryGetValue("ArtifactID", StringComparison.InvariantCultureIgnoreCase, out artifactIDToken)) { artifactID = Convert.ToInt32(artifactIDToken.ToString()); } if (resultObject.TryGetValue("Name", StringComparison.InvariantCultureIgnoreCase, out nameToken)) { name = Convert.ToString(nameToken.ToString()); } logger.LogInformation($"ReadSingleAsync succeeded. View ArtifactID is {artifactID}, Name is {name}"); } else { logger.LogError($"ReadSingleAsync failed - {result}"); } } } return success; }
Use the CreateSingleAsync endpoint to add a new view to a workspace. Send a request to this URL for the View Manager service:
<host>/Relativity.Rest/API/Relativity.Services.View.IViewModule/View%20Manager/CreateSingleAsync
The JSON request includes fields for a user-friendly name, fields to be included in the view, sorting information, and other properties required to create a view.
The following fields are required unless specifically identified as optional.
The Sorts object contains the following fields:
The SearchCriteria field contains the following fields based on the query provided in the sample JSON request listed in this section:
{ "workspaceArtifactID":1021106, "viewDTO":{ "ArtifactTypeID":10, "Order":100, "VisibleInDropdown":true, "QueryHint":"", "RelativityApplications":[ ], "Owner":{ "ArtifactID":0, "Name":"Public" }, "Name":"My View", "Fields":[ { "ArtifactID":1003667, "Name":"Control Number", "ViewFieldID":1000186 }, { "ArtifactID":1035375, "Name":"File Size", "ViewFieldID":1000574 } ], "Sorts":[ { "FieldIdentifier":{ "ViewFieldID":1000574, "Name":"File Size" }, "Direction":"Descending", "Order":10 } ], "GroupDefinitionFieldArtifactID":null, "SearchCriteria":{ "Conditions":[ { "Condition":{ "FieldIdentifier":{ "ArtifactID":1035375, "Name":"File Size" }, "ConditionType":"Criteria", "Operator":"GreaterThan", "NotOperator":false, "Value":2000 }, "BooleanOperator":"None" } ], "BooleanOperator":"None" } } }
{ "workspaceArtifactID":1021106, "viewDTO":{ "ArtifactTypeID":10, "Order":100, "VisibleInDropdown":true, "QueryHint":"", "RelativityApplications":[ ], "Dashboard":{ "ArtifactID":1039959, "Guids":[ ], "Name":"My Dashboard" }, "Owner":{ "ArtifactID":0, "Name":"Public" }, "Name":"My View", "Fields":[ { "ArtifactID":1003667, "Name":"Control Number", "ViewFieldID":1000186 }, { "ArtifactID":1035375, "Name":"File Size", "ViewFieldID":1000574 } ], "Sorts":[ { "FieldIdentifier":{ "ViewFieldID":1000574, "Name":"File Size" }, "Direction":"Descending", "Order":10 } ], "GroupDefinitionFieldArtifactID":null, "SearchCriteria":{ "Conditions":[ { "Condition":{ "FieldIdentifier":{ "ArtifactID":1035375, "Name":"File Size" }, "ConditionType":"Criteria", "Operator":"GreaterThan", "NotOperator":false, "Value":2000 }, "BooleanOperator":"None" } ], "BooleanOperator":"None" } } }
The response contains the Artifact ID of the newly created view.
Use the ReadSingleAsync endpoint to retrieve information about a view. Send a request to this URL for the View Manager service:
<host>/Relativity.Rest/API/Relativity.Services.View.IViewModule/View%20Manager/ReadSingleAsync
The request must include the following fields:
{ "workspaceArtifactID":1021106, "viewArtifactID":1042993 }
The JSON response for the ReadSingleAsync endpoint includes information about the object type assigned to the view, the owner, search criteria associated with it, sorting, and other data.
{ "ArtifactTypeID":10, "ObjectType":{ "DescriptorArtifactTypeID":10, "Guids":[ ], "Name":"Document", "ArtifactID":0 }, "Owner":{ "ArtifactID":0, "Name":"" }, "Order":100, "VisibleInDropdown":true, "QueryHint":"", "RelativityApplications":[ ], "SearchCriteria":{ "Conditions":[ { "Condition":{ "ConditionType":"Criteria", "Operator":"GreaterThan", "FieldIdentifier":{ "ArtifactID":1035375, "Guids":[ "1287c045-cf79-44b6-8a0a-0c8d7d60d745" ], "Name":"File Size", "ViewFieldID":1000574 }, "NotOperator":false, "Value":2000.0 }, "BooleanOperator":"None", "HasPermission":true } ], "BooleanOperator":"None" }, "Fields":[ { "ArtifactID":1003667, "Guids":[ "2a3f1212-c8ca-4fa9-ad6b-f76c97f05438" ], "Name":"Control Number", "ViewFieldID":1000186 }, { "ArtifactID":1035375, "Guids":[ "1287c045-cf79-44b6-8a0a-0c8d7d60d745" ], "Name":"File Size", "ViewFieldID":1000574 } ], "Sorts":[ { "Direction":"Descending", "FieldIdentifier":{ "ArtifactID":1035375, "Guids":[ "1287c045-cf79-44b6-8a0a-0c8d7d60d745" ], "Name":"File Size", "ViewFieldID":1000574 }, "Order":0 } ], "SystemCreatedBy":{ "ArtifactID":1027610, "Name":"Admin, Admin" }, "SystemCreatedOn":"2017-04-04T21:37:42.087", "SystemLastModifiedBy":{ "ArtifactID":1027610, "Name":"Admin, Admin" }, "SystemLastModifiedOn":"2017-04-04T21:37:42.087", "IsVisible":true, "IsSystemView":false, "IsRelationalFieldView":false, "ArtifactID":1042993, "Name":"My View" }
{ "ArtifactTypeID":10, "ObjectType":{ "DescriptorArtifactTypeID":10, "Guids":[ ], "Name":"Document", "ArtifactID":0 }, "Owner":{ "ArtifactID":0, "Name":"" }, "Order":100, "VisibleInDropdown":true, "QueryHint":"", "RelativityApplications":[ ], "Dashboard":{ "ArtifactID":1039959, "Guids":[ ], "Name":"My Dashboard" }, "SearchCriteria":{ "Conditions":[ { "Condition":{ "ConditionType":"Criteria", "Operator":"GreaterThan", "FieldIdentifier":{ "ArtifactID":1035375, "Guids":[ "1287c045-cf79-44b6-8a0a-0c8d7d60d745" ], "Name":"File Size", "ViewFieldID":1000574 }, "NotOperator":false, "Value":2000.0 }, "BooleanOperator":"None", "HasPermission":true } ], "BooleanOperator":"None" }, "Fields":[ { "ArtifactID":1003667, "Guids":[ "2a3f1212-c8ca-4fa9-ad6b-f76c97f05438" ], "Name":"Control Number", "ViewFieldID":1000186 }, { "ArtifactID":1035375, "Guids":[ "1287c045-cf79-44b6-8a0a-0c8d7d60d745" ], "Name":"File Size", "ViewFieldID":1000574 } ], "Sorts":[ { "Direction":"Descending", "FieldIdentifier":{ "ArtifactID":1035375, "Guids":[ "1287c045-cf79-44b6-8a0a-0c8d7d60d745" ], "Name":"File Size", "ViewFieldID":1000574 }, "Order":0 } ], "SystemCreatedBy":{ "ArtifactID":1027610, "Name":"Admin, Admin" }, "SystemCreatedOn":"2017-04-04T21:37:42.087", "SystemLastModifiedBy":{ "ArtifactID":1027610, "Name":"Admin, Admin" }, "SystemLastModifiedOn":"2017-04-04T21:37:42.087", "IsVisible":true, "IsSystemView":false, "IsRelationalFieldView":false, "ArtifactID":1042993, "Name":"My View" }
You can retrieve each view in a workspace for a specific Artifact ID by making a call with the RetrieveViewsByContextArtifactIDAsync endpoint. To learn more, visit
<host>/Relativity.Rest/API/Relativity.Services.View.IViewModule/View%20Manager/RetrieveViewsByContextArtifactIDAsync
The JSON request includes the Artifact ID of the workspace which contains the view and the Artifact ID of the view.
The following fields are required unless specifically identified as optional.
{ "workspaceArtifactID":1021106, "artifactTypeID":10 }
You can retrieve each view that is associated with a saved search in a workspace by making a call with the RetrieveViewsByContextArtifactIDForSearchAsync endpoint. To learn more, visit Saved Search. Send a request to this URL for the View Manager service:
<host>/Relativity.Rest/API/Relativity.Services.View.IViewModule/View%20Manager/RetrieveViewsByContextArtifactIDForSearchAsync
The JSON request includes the Artifact ID of the workspace which contains the saved search(es).
The following fields are required unless specifically identified as optional.
JSON response contains an array of SearchViewResponse objects. Each of them represents properties of a single View for Search in a specified Workspace.
There is a number of fields that do not show up in JSON response if their value is null. These fields are: "Order", "SearchProviderID", "ThreadMethod", "PayloadFieldArtifactID", "GroupDefinitionArtifactID" and "DashboardArtifactID"
{ "ArtifactID": 1039627, "Name": "All Documents Search", "ArtifactTypeID": 10, "IsVisible": false, "RenderLinks": true, "Type": "Search", "IsReport": false, "ViewByFamily": 0, "QueryHint": "", "SearchText": "", "AvailableInObjectTab": false, "VisualizationType": 0, "IsManualRerun": false, "ArtifactType": "Search" }, { "ArtifactID": 1039629, "Name": "All Documents With Natives Search", "ArtifactTypeID": 10, "IsVisible": false, "RenderLinks": true, "Type": "Search", "IsReport": false, "ViewByFamily": 0, "QueryHint": "", "SearchText": "" "AvailableInObjectTab": false, "VisualizationType": 0, "IsManualRerun": false, "ArtifactType": "Search" } ]
You can update the properties of a view by making a call with the UpdateSingleAsync endpoint. Send a request to this URL for the View Manager service:
<host>/Relativity.Rest/API/Relativity.Services.View.IViewModule/View%20Manager/UpdateSingleAsync
The JSON request includes fields for the workspace Artifact ID, the Artifact ID of the view, and other properties that you can update on the view.
The following fields are required unless specifically identified as optional.
The Sorts object contains the following fields:
The SearchCriteria object contains the following fields based on the query provided in the sample JSON request listed in this section:
{ "workspaceArtifactID":1021106, "viewDTO":{ "ArtifactID":1029049, "ArtifactTypeID":10, "Order":100, "VisibleInDropdown":true, "QueryHint":"", "RelativityApplications":[ ], "Owner":{ "ArtifactID":0, "Name":"Public" }, "Name":"My View", "Fields":[ { "ArtifactID":1003667, "Name":"Control Number", "ViewFieldID":1000186 }, { "ArtifactID":1035375, "Name":"File Size", "ViewFieldID":1000574 } ], "Sorts":[ { "FieldIdentifier":{ "ViewFieldID":1000574, "Name":"File Size" }, "Direction":"Descending", "Order":10 } ], "GroupDefinitionFieldArtifactID":null, "SearchCriteria":{ "Conditions":[ { "Condition":{ "FieldIdentifier":{ "ArtifactID":1035375, "Name":"File Size" }, "ConditionType":"Criteria", "Operator":"GreaterThan", "NotOperator":false, "Value":2000 }, "BooleanOperator":"None" } ], "BooleanOperator":"None" } } }
{ "workspaceArtifactID":1021106, "viewDTO":{ "ArtifactID":1029049, "ArtifactTypeID":10, "Order":100, "VisibleInDropdown":true, "QueryHint":"", "RelativityApplications":[ ], "Dashboard":{ "ArtifactID":1039959, "Guids":[ ], "Name":"My Dashboard" }, "Owner":{ "ArtifactID":0, "Name":"Public" }, "Name":"My View", "Fields":[ { "ArtifactID":1003667, "Name":"Control Number", "ViewFieldID":1000186 }, { "ArtifactID":1035375, "Name":"File Size", "ViewFieldID":1000574 } ], "Sorts":[ { "FieldIdentifier":{ "ViewFieldID":1000574, "Name":"File Size" }, "Direction":"Descending", "Order":10 } ], "GroupDefinitionFieldArtifactID":null, "SearchCriteria":{ "Conditions":[ { "Condition":{ "FieldIdentifier":{ "ArtifactID":1035375, "Name":"File Size" }, "ConditionType":"Criteria", "Operator":"GreaterThan", "NotOperator":false, "Value":2000 }, "BooleanOperator":"None" } ], "BooleanOperator":"None" } } }
The response returns a status code of 200 when the service successfully updates a view.
You can use the GetAccessStatusAsync endpoint to determine whether a user has View permissions to a view, and to the fields used in the criteria for search conditions on the view. Send a request to this URL for the View Manager service:
<host>/Relativity.Rest/API/Relativity.Services.View.IViewModule/View%20Manager/GetAccessStatusAsync
The request must include the following fields:
{ "workspaceArtifactID":1021106, "artifactID":1041929 }
The response returns the following fields:
{ "Exists":true, "CanView":true, "CanViewCriteriaFields":true }
Use the GetViewOwnersAsync endpoint to retrieve a list of users in a workspace. You can then use this list to assign owners to a view. To be designated as an owner, a user must have View permissions for views. For more information, see Security and permissions on the Relativity 9.6 Documentation site.
To retrieve a list of users, send a request to this URL for the View Manager service:
<host>/Relativity.Rest/API/Relativity.Services.View.IViewModule/View%20Manager/GetViewOwnersAsync
The request must contain the Artifact ID of the workspace that contains the view. When the owner is set to Public, all users with View permissions can see the view.
{ "workspaceArtifactID":1028991 }
The response is an array of UserRef objects. Each object contains the ArtifactID and the name of a user.
[ { "ArtifactID":0, "Name":"Public" }, { "ArtifactID":9, "Name":"Admin, Relativity" }, { "ArtifactID":777, "Name":"Service Account, Relativity" } ]
Use the GetObjectTypesAsync endpoint to retrieve a list of object types in a workspace. You can select an object type from this list that is used for populating the ObjectType field for the View object. Send a request to this URL for the View Manager service:
<host>/Relativity.Rest/API/Relativity.Services.View.IViewModule/View%20Manager/GetObjectTypesAsync
The request must contain the Artifact ID of the workspace that contains the view.
{ "workspaceArtifactID":1028991 }
The response is an array of ObjectTypeRef objects that contain the DescriptorArtifactTypeID, Guids, Name, and ArtifactID for the object type.
[ { "DescriptorArtifactTypeID":1000020, "Guids":[ ], "Name":"Analytics Categorization Result", "ArtifactID":0 }, { "DescriptorArtifactTypeID":1000021, "Guids":[ ], "Name":"Analytics Categorization Set", "ArtifactID":0 }, { "DescriptorArtifactTypeID":1000022, "Guids":[ ], "Name":"Analytics Category", "ArtifactID":0 }, { "DescriptorArtifactTypeID":27, "Guids":[ ], "Name":"Batch", "ArtifactID":0 }, { "DescriptorArtifactTypeID":10, "Guids":[ ], "Name":"Document", "ArtifactID":0 } ]
Community Updates |
|||
Aero Developer FAQ | Evolving the Platform | Most recent release notes | |
Learn more | Learn more | Learn more |
Additional Resources |
|||
![]() |
![]() |
||
Access Third-Party Tools with GitHub | Create .NET Apps Faster with NuGet | ||
Visit github | visit nuget |