Nav

Working with Notifications

logo cloud active logo hybrid disabled logo server disabled logo pcf disabled

This document deals with calling the CloudHub API. For instructions on how to perform these same tasks more easily via the Runtime Manager UI, see CloudHub and its child pages.

The notifications API allows you to list notifications, create notifications and mark as read. All resources or methods that return or accept a type (except where noted) use the application JSON type. As an example, here’s an example of what the result from the notifications resource looks like.

Alerts and Notifications are a feature that is currently only available for applications deployed to CloudHub workers. They are not available for applications that you deploy via the Runtime Manager to local servers. See Deployment Strategies for more details.

         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
"data":
  [
    {
      "domain" : "myapp",
      "username" : "joecloud",
      "priority" : "INFO",
      "message" : "Something happened",
      "createdAt" : "2015-05-10T23:42:53.010Z",
      "read" : false,
      "readOn" : "2015-02-12T19:51:34.428Z",
      "href" : "https://prod.anypoint.mulesoft.com/cloudhub/api/notifications/518d85fde4b00795a6ec3394"},
      "transactionId": "2a097804-f0d5-11e2-b4d2-9dd46521a02d",
      "properties": {
         "recordId" : "1234"
      }
  ],
  "total": 1
}

Notification Object Properties

The following are the properties for applications.

Property Description

createdAt

The time the notification was created in ISO8601 format.

domain

The application that the notification is associated with, if any.

href

The URL of the notification. This can be used as the URL to update the notification status.

message

The notification message.

priority

The priority - INFO, WARN, ERROR

properties

A map of custom properties associated with this notification. These are supplied by an application when creating the notification.

read

Whether or not the notification has been read.

readOn

The time the notification was read in ISO8601 format.

tenantId

The ID of the tenant that the notification is associated with.

transactionId

The ID of the transaction that this notification is associated with.

username

The user who created the notification.

Operations for Notifications

The following is a summary of notification related operations:

Operation Resource Description

GET

/api/notifications

Lists notifications for all applications

/api/notifications

Create a new notification.

PUT

/api/notifications

Mark all notifications as read.

PUT

/api/notifications/{id}

Update the status of a notification.