Situations API

GETs (reading data)

Situation API GET functions

Resource

Description

/api/v2/situations?limit=2

Get a list of situations. The default for offset is 0, and the default for limit is 10. To get all results, use limit=0 as a parameter on the URL (for example, GET /api/v2/situations?offset=20&limit=10).

POSTs (creating and modifying situations)

POST requires form data using application/json as a Content-Type.

Situation API Post functions
Resource Description

/api/v2/situations/create

Create situation.

  • alarmIdList (List): Comma‑separated list of alarm IDs to associate with the new situation.

  • description (String): User‑friendly description of the situation.

  • diagnosticText (String): Diagnostic information about the situation.

/api/v2/situations/associateAlarm

Associate Alarm with Situation.

  • situationId Integer – ID of the existing situation..

  • alarmIdList List – Comma-separated list of alarm IDs to add..

  • feedback (optional): String – Feedback message.

/api/v2/situations/clear

Clear Single Situation .

  • situationId Integer – ID of the situation to clear

/api/v2/situations/alarms/clear

Remove from situation and clean multiple Alarms .

  • situationId Integer – ID of the existing situation.

  • alarmIdList List – Comma-separated list of alarm IDs to remove from situation and clear.

/api/v2/situations/accepted/{id}

Accept Situation .

  • id Integer (Path Parameter) – The ID of the situation to accept

Examples

Create a Situation

curl -v -X POST http://<opennms-host>:<port>/opennms/api/v2/situations/create   -H "Content-Type: application/json"   -u <username>:<password>   -d '{
        "alarmIdList": [Alarms Id separated by comma]
        "description": "some description here ",
        "diagnosticText": "diagnostic text here "
      }'

Associate Alarm to Situation

curl -X POST http://<opennms-host>:<port>/opennms/api/v2/situations/associateAlarm \
  -H "Content-Type: application/json" \
  -u <username>:<password> \
  -d '{
        "situationId": "Situation ID",
        "alarmIdList": [Alarms Id  separated by comma]
      }'

DELETE (Remove Alarms from situation)

DELETE requires form data using application/json as a Content-Type.

Situation API Delete functions
Resource Description

/api/v2/situations/removeAlarm

Remove Alarm from situation.

  • situationId Integer – ID of the existing situation.

  • alarmIdList List – Comma-separated list of alarm IDs to remove from the situation.

Examples

Remove Alarm From Situation

curl -X DELETE http://<opennms-host>:<port>/opennms/api/v2/situations/removeAlarm   -H "Content-Type: application/json"   -u <username>:<passowrd>   -d '{
       "situationId": "Situation ID",
        "alarmIdList": [Alarms Id  separated by comma]
      }'