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"
}
Received response:
Request failed with error:
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"
}
Received response:
Request failed with error: