Password Bank Manager service
You can use this service to retrieve passwords when developing a custom application that needs access to content in password-protected documents. Additionally, you might create a custom page that displays a list of document passwords for reference or other purposes.
The Relativity Services API also provides functionality for retrieving document passwords. For more information, see Retrieve document passwords.
This page contains the following information:
Client code sample
To use the Password Bank Manager service, send an HTTP request that makes a POST method call. See the following base URL for this service:
<host>/Relativity.REST/api/Relativity.Services.PasswordBank.IPasswordBankModule/PasswordBankManager/
You can use the following .NET code as the REST client for retrieving document passwords. The code illustrates how to perform the following tasks:
- Instantiate an HttpClient object for sending requests and responses using the URL for the Password Bank Manager service.
- Set the required headers for the request.
- Set the passwordBankUrl variable to the URL for the retrieval operation.
- Set the string represented by parameters variable to the JSON input required to retrieve the passwords.
- Use the PostAsync() method to send a post request.
- Return the results of the request and deserialize it.
List<string> passwords = null; //Set up the client. HttpClient httpClient = new System.Net.Http.HttpClient(); httpClient.BaseAddress = new Uri("http://localhost/"); //Set up the required headers. httpClient.DefaultRequestHeaders.Add("X-CSRF-Header", "-"); httpClient.DefaultRequestHeaders.Add("Authorization", "Basic c2FtcGxlYWRtaW5AcmVsYXRpdml0eS5yZXN0OlMwbTNwQHNzdzByZA=="); //Set up the required parameters. var parameters = new { workspaceArtifactId = 1015349 }; System.Net.Http.StringContent parametersJson = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(parameters), System.Text.Encoding.UTF8, "application/json"); //Make the HTTP request. String passwordBankUrl = "Relativity.REST/API/Relativity.Services.PasswordBank.IPasswordBankModule/PasswordBankManager/GetAllPasswordsAsync"; HttpResponseMessage response = await httpClient.PostAsync(passwordBankUrl, parametersJson); //Parse the result with Json.NET. if (response.IsSuccessStatusCode) { string json = await response.Content.ReadAsStringAsync(); passwords = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(json); }
Retrieve document passwords
To retrieve a list of document passwords from a workspace, send a request to this URL for the Password Bank Manager service:
<host>/Relativity.REST/api/Relativity.Services.PasswordBank.IPasswordBankModule/PasswordBankManager/GetAllPasswordsAsync
The request must include the Artifact ID of the workspace, which contains the document passwords that you want to retrieve.
{ "workspaceArtifactId": 1015349 }
The response returns a list of document passwords in the workspace. The list includes only those passwords that the requesting user has permissions to access. If you pass an invalid workspace ID, the Password Bank Manager service throws a ValidationException. If you don't have required permissions, the service returns an empty list. For information, see Document password fundamentals.
[ "password", "password3", "password6", "password10", "password7", "password12", "password1" ]