Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Keep 200 for Create in v2 api

Outages API - V2

...

The v2 api has added support for "ELEMENT OUTAGES" 

See ALL ABOUT ELEMENT OUTAGES

...

, for example defining an outage on just a single interface on a node.  See ALL ABOUT ELEMENT OUTAGES.

Public API for Outages "http[s]://server/en/omk/admin/api/v2/outages"

...

All these methods require authentication.

POST http://server/en/omk/admin/login

Form data:

  • username
  • password



GET of /v2/outages for List

GET http[s]://server/en/omk/admin/api/v2/outages

If your GET call provides an Accept header indicating JSON, or if you use a .json suffix, eg /v2/outages.json as URI, then It will look for matching Outages and return their properties in the form of a JSON object, an array of Outages.

...

HTTP Status

Body

Description

401 UnauthorizedJSON object with an error propertyYou are not authenticated.
403 ForbiddenJSON object with an error propertyYou are not authorized.

GET http://server/en/omk/admin/api/v2/outages

Returns a list of outages.

...

If your GET call provides an accept header indicating application/json or if you use /en/omk/admin/api/v2/outages/<id>.json as URI, then the Outage will be looked up and all properties will be returned in the form of a JSON object.

...

GET http://server/en/omk/admin/api/v2/outages/#ID

Ex. http://server/en/omk/admin/api/v2/outages/e17b6efa-a3da-4281-919c-bef26b96ff80

Returns an outage.

Response:

...

HTTP Status

Body

Description
201200 OKJSON object with success and id propertiesThe success property is set to 1 and only if the request was successful.
The id property is the new event's ID

...

Create Outage
POST  http://server/en/omk/admin/api/v2/outages

...

Payload example:

Code Block

From opCharts 4.5.7 onwards, ELEMENT OUTAGES are supported

{
    "change_id": "ticket #1234",
    "description": "Emergency outage",
    "elements" : [
        {  "node_name": "Switch-1",
           "element_name" : "Vlan2"
        },
        {  "node_name": "Switch-2",
           "element_name" : "regex:^Vlan.*?$"
        }
    ],
    "start": "11-May-2023 23:21:03",
    "end": "15-May-2023 23:21:03"
}


###############################################

Before {
opCharts 4.5.7 only Node outages are supported

{
    "change_id": "001",
    "current": "current",
    "description": "testing outage 1",
    "end": 1684763940,
    "frequency": "once",
    "nodes":["Switch1","Switch-111"],
    "options": {
        "nostats": 0
    },
    "start": 1684072800
}

Return

Returns 200 if the outage was successfully created.

Code Block
{
    "id": "0ea7644e-b6fa-4fa2-9b33-a86b79db21a4",
    "success": 1
}

...

HTTP Status

Body

Description
201200JSON object with success and id propertiesThe success property is set to 1 and only if the request was successful.
The id property is the new event's ID

...

Code Block
{
    "id": "0ea7644e-b6fa-4fa2-9b33-a86b79db21a4",
    "success": 1
}

...

DELETE of /v2/outages/<id>

...

for Delete

Create Delete an Outage by sending a pay-load JSON object and This will create an request with the Outage on your system and receive an appropriate response.

...

DELETE http://server/en/omk/admin/api/v2/outages/0ea7644e-b6fa-4fa2-9b33-a86b79db21a4

Returns 200 if the outage was successfully removed.

...

Property

Description

Example

id

A globally unique Outage ID

0ea7644e-b6fa-4fa2-9b33-a86b79db21a4
change_id

Insert any reference number if required in the change id field

ticket #12345
currentIf the outage is current or scheduled/future outage. IS THIS 'currrentcurrent' for scheduled or null for future.current
descriptionLong description of an OutageThis is a test outage
frequencyone of 'once', 'daily', 'weekly' or 'monthly'once



start

date and time of outage start. See XYZ for description of allowed values.


 2023-10-31T0331T17:00:00+0000
enddate and time of outage end. See XYZ for description of allowed values. 2023-10-31T03 31 May 2023 03:30 :00+0000pm



nodesList of nodes for which Outages is defined. IS THIS MANDATORY?[ 'Switch-1','Switch-2' ]
element

List of elements from nodes for which Outages are defined.

IS THIS MANDATORY?

DOCUMENT REGEX OR SEE LINK

CAN I DO NODE REGEX?

HOW DO WE HANDLE OTHER TYPES OF ELEMENTS

 [ {

  "element_name": "Vlan2",
  "node_name": "Switch-1"
}, {

   "element_name": "regex:^Vlan.*?$",
   "node_name": "Switch-2"
} ]


 [ {

  "node_name": "Switch-1"
}, {

   "element_name": "regex:^Vlan.*?$",
   "node_name": "Switch-2"
} ]

options

optional key=values to adjust NMIS behaviour during an outage 

DOCUMENT THE KEYS AND VALUES

"Normal"



...