MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with the easyNag API.

Authenticating requests

To authenticate requests, include a parameter user_key in the body of the request.

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

Your User-Key can be located within the easyNag App. The notification will be broadcasted to all of your devices.

Push Notifications

Endpoints for sending push notifications

POST v1/push/alert

requires authentication

Example request:
curl --request POST \
    "https://api.easynag.com/v1/push/alert" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"user_key\": \"abcdef1234567890abcdef1234567\",
    \"what\": \"SERVICE\",
    \"type\": \"PROBLEM\",
    \"state\": \"CRITICAL\",
    \"hostname\": \"www.example.com\",
    \"service\": \"fs_\\/\",
    \"output\": \"CRITICAL - 95.00% in use\",
    \"date\": \"2022-06-02 20:00\",
    \"instance\": \"MyMonitoring\"
}"
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://api.easynag.com/v1/push/alert',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'user_key' => 'abcdef1234567890abcdef1234567',
            'what' => 'SERVICE',
            'type' => 'PROBLEM',
            'state' => 'CRITICAL',
            'hostname' => 'www.example.com',
            'service' => 'fs_/',
            'output' => 'CRITICAL - 95.00% in use',
            'date' => '2022-06-02 20:00',
            'instance' => 'MyMonitoring',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://api.easynag.com/v1/push/alert'
payload = {
    "user_key": "abcdef1234567890abcdef1234567",
    "what": "SERVICE",
    "type": "PROBLEM",
    "state": "CRITICAL",
    "hostname": "www.example.com",
    "service": "fs_\/",
    "output": "CRITICAL - 95.00% in use",
    "date": "2022-06-02 20:00",
    "instance": "MyMonitoring"
}
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Example response (200):


{
    "response": "Notification accepted"
}
 

Request      

POST v1/push/alert

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

user_key   string   

Your User-Key Example: abcdef1234567890abcdef1234567

what   string   

HOST or SERVICE notification Example: SERVICE

type   string   

Notification type (e.g. PROBLEM, RECOVERY, ACKNOWLEDGEMENT) Example: PROBLEM

state   string   

The state of your alert (DOWN, UP, CRITICAL) Example: CRITICAL

hostname   string   

The name of your host Example: www.example.com

service   string  optional  

The name of your service Example: fs_/

output   string   

Check output Example: CRITICAL - 95.00% in use

date   string   

The date and time Example: 2022-06-02 20:00

instance   string   

Your easyNag instance name Example: MyMonitoring

POST v1/push/info

requires authentication

Example request:
curl --request POST \
    "https://api.easynag.com/v1/push/info" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"user_key\": \"abcdef1234567890abcdef1234567\",
    \"message\": \"Reminder - Scheduled maintenance will take place today. Ticket-ID: 1234567.\",
    \"silent\": false
}"
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://api.easynag.com/v1/push/info',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'user_key' => 'abcdef1234567890abcdef1234567',
            'message' => 'Reminder - Scheduled maintenance will take place today. Ticket-ID: 1234567.',
            'silent' => false,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://api.easynag.com/v1/push/info'
payload = {
    "user_key": "abcdef1234567890abcdef1234567",
    "message": "Reminder - Scheduled maintenance will take place today. Ticket-ID: 1234567.",
    "silent": false
}
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Example response (200):


{
    "response": "Notification accepted"
}
 

Request      

POST v1/push/info

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

user_key   string   

Your User-Key Example: abcdef1234567890abcdef1234567

message   string   

The message you want to send Example: Reminder - Scheduled maintenance will take place today. Ticket-ID: 1234567.

silent   boolean  optional  

If true, no vibration or sound will be played for this notification Example: false