.. _integration_alerts: *********************************** |c3-short| Alerts REST API for |cp| *********************************** .. important:: The REST API is available when running |c3-short| in :ref:`Normal mode ` only. To access the Alerts REST API page: .. include:: ../includes/alerts-bell-nav.rst #. Click the **REST API** tab. The **REST API** page provides details of the alerts REST endpoint that can be used to programmatically obtain historical alert information. After the alerts history starts populating, the Sample Response appears. .. figure:: /images/c3-alerts-rest-api-pop.png :width: 600px :alt: Populated Alerts GET REST API history page Populated Alerts GET REST API history page .. _alerts_integration_rest_api: REST API example ================ .. http:get:: /2.0/alerts/history Get the most recent alerts. :query int limit: The maximum number of records to return :query long ts: The most recent alert to return (in milliseconds since epoch) :>json string guid: The unique ID of this alert :>jsonarr string timestamp: Milliseconds since the epoch when this alert was issued :>jsonarr map monitoringTrigger: Trigger definition that caused this alert to be issued :>jsonarr string monitoringTrigger.guid: The unique ID of this trigger :>jsonarr string monitoringTrigger.name: The name of this trigger :>jsonarr array triggers: The trigger cause associated with `monitoringTrigger` :>jsonarr string triggers[i].window: Milliseconds since the epoch associated with the underlying data that caused this trigger was issued :>jsonarr array actions: Actions taken due to the firing of `monitoringTrigger` :>jsonarr string actions[i].guid: The unique ID of the action taken :>jsonarr string actions[i].name: The name of the action taken :>jsonarr map actions[i].email: The email address that the alert was sent to **Example request**: .. sourcecode:: http GET /2.0/alerts/history HTTP/1.1 Accept: application/json **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json [ { "guid": "50c0e74a-6368-43bf-bff7-fa51beff9ad9", "timestamp": "1516207447488", "monitoringTrigger": { "guid": "c8d72271-9f57-44b5-a6a4-97c97f0d1668", "name": "rock-cg-0 consumption" }, "triggers": [ { "window": "1516207320000", "hasError": false, "component": { "componentId": "rock-cg-0" }, "longValue": "0" } ], "actions": [ { "guid": "f593d79d-1bb7-4179-8997-6a7c8045dd8e", "name": "1212", "email": { "address": "sdfsdf@lskdjf.com", "subject": "skldfjlsdkfj" } } ] } ]