The User Information Manager service supports the retrieval of all users from a workspace or admin-level context. It provides the option to filter on a list of users with conditions set in a query. When you filter on the results, paging is also available. The service returns the Artifact ID, full name, and email address for each user. As a sample use case, you could use this service to retrieve user information for display in a view for a custom application.
The Relativity Services API also provides functionality for retrieving user information. For more information, see User Information Manager (.NET).
This page contains the following information:
See this related page:
You can use the following .NET code as a REST client for making calls with the User Information Manager service. This code illustrates how to perform the following tasks:
For more information about running this code sample, see Relativity SDK samples.
public async Task<bool> RetrieveAllUsers(IHelper helper) { //Set the ForContext for the method. kCura.Relativity.Client.SamplesLibrary.Logging.ISampleLogger logger = _logger.ForContext("MethodName", nameof(RetrieveAllUsers), false); bool success = false; int artifactID = 0; string fullName = string.Empty; string email = string.Empty; 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(); // 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 GET method string url = "/Relativity.Rest/API/Relativity.Users/workspace/" + SampleWorkspace_ID + "/users/retrieveall"; HttpResponseMessage response = await httpClient.GetAsync(url); string result = response.Content.ReadAsStringAsync().Result; success = HttpStatusCode.OK == response.StatusCode; if (success) { // Parse the result with Json.NET JArray resultJArray = JArray.Parse(result); JToken resultToken = resultJArray.Children().FirstOrDefault(); if (resultToken == null || resultToken.Count() == 0) { logger.LogInformation("Relativity.Users\retrieveall API succeeded but returned empty result."); return success; } JToken artifactIDToken; JToken fullNameToken; JToken emailToken; JObject resultChildObject = resultToken as JObject; resultChildObject.TryGetValue("ArtifactID", StringComparison.InvariantCultureIgnoreCase, out artifactIDToken); resultChildObject.TryGetValue("FullName", StringComparison.InvariantCultureIgnoreCase, out fullNameToken); resultChildObject.TryGetValue("Email", StringComparison.InvariantCultureIgnoreCase, out emailToken); artifactID = int.Parse(artifactIDToken.ToString()); fullName = fullNameToken.ToString(); email = emailToken.ToString(); logger.LogInformation("Relativity.Users\retrieveall API succeeded. User(first in the list) ArtifactID is {artifactID}, FullName is {fullName}, Email is {email}.", artifactID, fullName, email); } else { logger.LogError("Error: Relativity.Users\retrieveall was not successful - {result}", result); } return success; }
You can retrieve a list of all users in a workspace or at the admin-level context. To make a request, use the GET method and specify the Artifact ID for the workspace containing users that you want to retrieve.
Use a URL with the following general format:
<host>/Relativity.Rest/API/Relativity.Users/workspace/{workspaceId}/users/retrieveall
To retrieve users at the admin-level context, specify -1 as the workspaceId:
<host>/Relativity.Rest/API/Relativity.Users/workspace/-1/users/retrieveall
The response contains the following fields:
[ { "ArtifactID":9, "FullName":"Smith, Jane", "Email":"jsmith@example.com" }, { "ArtifactID":1117813, "FullName":"Jones, Bob", "Email":"bjones@example.com" }, { "ArtifactID":777, "FullName":"Green, Tom", "Email":"tgreen@example.com" } ]
Like the retrieveall endpoint, the retrieveusersby endpoint gets a list of all users and their information. It also filters on the list of users with query conditions, and supports paging.
Use a URL with the following general format:
<host>/Relativity.Rest/API/Relativity.Users/workspace/{workspaceId}/users/retrieveusersby
To retrieve users at the admin-level context, specify -1 as the workspaceId:
<host>/Relativity.Rest/API/Relativity.Users/workspace/-1/users/retrieveusersby
To make a request, use the POST method. Specify the Artifact ID for the workspace containing users that you want to retrieve. Additionally, add a query to the body of the request for filtering on the results, and provide paging information.
The request must include the following fields:
{ "query": { "condition": "('FullName' LIKE ['admin'])", "sorts": [ { "Direction": "Ascending", "FieldIdentifier": { "Name": "FullName" } } ] }, "start": 1, "length": 10 }
The response contains the following fields:
{ "DataResults":[ { "ArtifactID":1017295, "FullName":"Admin, Relativity", "Email":"admin@sample.com" }, { "ArtifactID":1017306, "FullName":"Admin Assistant, Relativity", "Email":"assistant@sample.com" } ], "ResultCount":2, "TotalResultCount":12, "CurrentStartIndex":11 }
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 |