Notifications Manager service (MotD)

Relativity REST API supports operations with the Message of the Day (MotD) though the Notifications service. The operations available through the service are equivalent to the asynchronous methods for interacting with the MOTDRef objects in the Relativity Services API. For more information, see Notifications Manager API (MotD).

Note: You can only use the POST method when interacting with the service.

This page contains the following information:

Postman sample file

You can use the Postman sample file to become familiar with making calls to endpoints on the Notifications Manager service. To download the sample file, click Notifications Manager service Postman file.

To get started with Postman, complete these steps:

  1. Obtain access to a Relativity environment. You need a username and password to make calls to your environment.
  2. Install Postman.
  3. Import the Postman sample file for the service. For more information, see Working with data files on the Postman web site.
  4. Select an endpoint. Update the URL with the domain for your Relativity environment and any other variables.
  5. In the Authorization tab, set the Type to Basic Auth, enter your Relativity credentials, and click Update Request.
  6. See the following sections on this page for more information on setting required fields for a request.
  7. Click Send to make a request.

Client code sample

The following is an example of .NET REST client code for creating a Matter. The code can be used for all Matter Manager service operations with different endpoint URLs and input JSON values.

//Set up the REST client.
            
HttpClient httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("http://localhost/");

//Set the required headers.
            
httpClient.DefaultRequestHeaders.Add("X-CSRF-Header", "-");
httpClient.DefaultRequestHeaders.Add("Authorization", "Basic c2FtcGxlYWRtaW5AcmVsYXRpdml0eS5yZXN0OlMwbTNwQHNzdzByZA==");

//Call Create for a Matter.
            
string url = "Relativity.REST/api/Relativity.Services.Notifications.INotificationsModule/Notifications/ReadMOTDAsync";
StringContent content = new StringContent(CreateInputJSON, Encoding.UTF8, "application/json");
HttpResponseMessage response = httpClient.PostAsync(url, content).Result;
string result = response.Content.ReadAsStringAsync().Result;
bool success = HttpStatusCode.Created == response.StatusCode;

//Parse the result with Json.NET.
            
JObject resultObject = JObject.Parse(result);        

A complete code sample of the REST API operations on MotD is included in the APISamples.sln solution in the Relativity SDK:

  • kCura.Relativity.Matter.SamplesLibrary.CS\REST\MOTD.cs

For more information, see Relativity SDK samples.

Read

Use this Notifications service URL to read the MotD:

  <host>/Relativity.REST/api/Relativity.Services.Notifications.INotificationsModule/Notifications/ReadMOTDAsync   

The request doesn't include any parameters.

The response returns a JSON representation of the MotD.

{
  "Message": "\r\n<p><font face=\"trebuchet ms,verdana,arial,helvetica,sans-serif\" size=\"2\" color=\"#ff0000\"><b style=\"background-color: rgb(102, 255, 0);\">Relativity will be shut down at 5:00 for scheduled maintenance.</b></font></p>\r\n\r\n\r\n\r\n\r\n",
  "Enabled": true
}

Update

Use this Notifications service URL to update the MotD:

  <host>/Relativity.REST/api/Relativity.Services.Notifications.INotificationsModule/Notifications/UpdateMOTDAsync

The request must include a valid JSON representation of the MotD DTO.

Note: You must include all DTO field information in the update. You cannot update individual fields because fields left empty will be cleared on the update. All DTO fields are required except for system/user created by/created on.

The following JSON sample illustrates how to enable and change the MotD. Note that in order to contain formatting, such as font family, size, and color, the message must be specified as HTML. If you specify plain text, default system formatting is applied.

{
  "motd": {
    "Message": "\r\n<p><font face=\"trebuchet ms,verdana,arial,helvetica,sans-serif\" size=\"2\" color=\"#ff0000\"><b style=\"background-color: rgb(102, 255, 0);\">The system is going offline in 5 minutes!</b></font></p>\n",
    "Enabled": true
  }
}

The response does not contain any data. Success or failure are indicated by the HTTP status code. For more information, see HTTP status codes.

Dismiss

Use this Notifications service URL to dismiss the current MotD for a user:

  <host>/Relativity.Rest/API/Relativity.Services.Notifications.INotificationsModule/Notifications/DismissMOTDAsync

The request must include a valid user ID. The following JSON sample illustrates how to dismiss the MotD for a user.

{

  "userId": 9

}

The response does not contain any data. Success or failure are indicated by the HTTP status code. For more information, see HTTP status codes.

Has Dismissed

Use this Notifications service URL to check if a user has dismissed the current MotD:

  <host>/Relativity.Rest/API/Relativity.Services.Notifications.INotificationsModule/Notifications/HasDismissedMOTDAsync

The request must include a valid user ID. The following JSON sample illustrates how to dismiss the MotD for a user.

{

  "userId": 9

}

The response returns a boolean value indicating if the user has dismissed the current MotD.

  true

Is Text-Only

User this Notifications service URL to check if the MotD is set to only allow for the entry and display of text.

  <host>/Relativity.Rest/API/Relativity.Services.Notifications.INotificationsModule/Notifications/IsTextOnlyMOTDAsync

The response returns a boolean value indicating if the user has dismissed the current MotD.

  true