NAV Navbar

Logo home
shell php python

Introduction

Welcome to the Pingrely API !.

The Pingrely API is a way for you to automate your interaction with the Pingrely system.

With the API, you can create your own scripts or applications with most of the functionality you can find inside the Pingrely control panel.

The Pingrely API is RESTful and HTTP-based. Basically, this means that the communication is made through normal HTTP requests.

For further information on RESTful, take a look at: https://en.wikipedia.org/w/index.php?title=REST

Authentication

To authorize, use this code:

import requests

url = "https://api.pingrely.com/v2/ping"

headers = {
    'cache-control': "no-cache"
    }

response = requests.get('https://api.pingrely.com/v2/ping', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/ping",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password https://api.pingrely.com/v2/ping

Make sure to replace username:password with your personal email and password.

Authentication is needed in order to use the Pingrely API, and for this a Pingrely account is required. The credentials used for accessing the API are the same used to access the Pingrely control panel - in other words your email address and your password.

You can also use your API Key, which is found in the API section of the control panel, to access the API using it as your username without password. This is specially useful for integrations where you don't want to store the user's email and password in your db.

The authentication method for user credentials is HTTP Basic Access Authentication (encrypted over HTTPS). This means you will provide your credentials every time you make a request. No sessions are used.

For further information on HTTP Basic Access Authentication, take a look at: http://en.wikipedia.org/wiki/HTTP_authentication

Server Address

The base server address is: https://api.pingrely.com

Please note that HTTPS is required. You will not be able to connect through unencrypted HTTP.

Providing Parameters

GET requests should provide their parameters as a query string, part of the URL.

POST, PUT and DELETE requests should provide their parameters as a query string. This should be part of the body, URL or a combination.

The encoding of the query string should be standard URL-encoding, as provided by various programming libraries.

HTTP/1.1 Status Code Definitions

The HTTP status code returned by a successful API request is defined in the documentation for that method. Usually, this will be 200 OK.

If something goes wrong, other codes may be returned. The API uses standard HTTP/1.1 status codes defined by RFC 2616.

JSON Responses

All responses are sent JSON-encoded. The specific responses (successful ones) are described in the documentation section for each method.

However, if something goes wrong, our standard JSON error message (together with an appropriate status code) follows this format:

"error":{ "result":false, "error":"The description of the message" }

See http://en.wikipedia.org/wiki/Json for more information on JSON.

Please note that all attributes of a method response are not always present. A client application should never assume that a certain attribute is present in a response.

Best Practices

Use caching

If you are building a web page using the Pingrely API, we recommend that you do all API request on the server side, and if possible cache them. If you get any substantial traffic, you do not want to call the API each time you get a page hit, since this may cause you to hit the request limit faster than expected. In general, whenever you can cache data, do so.

Send your user credentials in a preemptive manner

Some HTTP clients omit the authentication header, and make a second request with the header when they get a 401 Unauthorized response. Please make sure you send the credentials directly, to avoid unnecessary requests.

Use common sense

Should be simple enough. For example, don’t check for the status of a check every other second. The highest check resolution is one minute. Checking more often than that won’t give you much of an advantage.

The Internet is unreliable

Networks in general are unreliable, and particularly one as large and complex as the Internet. Your application should not assume it will get an answer. There may be timeouts.

Account

Get Account Details

HTTP Request

GET https://api.pingrely.com/v2/account

import requests

url = "https://api.pingrely.com/v2/ping"

headers = {
    'cache-control': "no-cache"
    }

response = requests.get('https://api.pingrely.com/v2/account', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/account",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password https://api.pingrely.com/v2/account

The above command returns JSON structured like this:

{
  "email": "sample@email.com",
  "name": "Sample User",
  "monitors": 10,
  "suscription": [
    {
      "plan": "basic",
      "active": true,
      "max_monitors": 10,
      "used_monitors": 5,
      "trial": false,
      "days_left": 0
    }
  ],
  "events": [
    {
      "monitor_id": 1,
      "timestamp": 1491948593,
      "type": 1,
      "reason": "HTTP Connect OK",
      "duration": 120
    },
    {
      "monitor_id": 1,
      "timestamp": 1491948473,
      "type": 0,
      "reason": "HTTP Connect Timeout",
      "duration": 0
    }
  ]
}

Response Attributes

Attribute Description Type
email The user’s email address String
name The user’s name String
monitors Number of running monitors Integer
suscription Subscription Plan Object
suscription.plan The name of the suscription plan String
suscription.active The status of the suscription Boolean
suscription.max_monitors The maximun number of monitors supported by the plan Integer
suscription.user_monitors The number of used monitors Integer
suscription.trial Is the plan in trial mode ? Boolean
suscription.days_left If the plan is in trial, how many days until it expires ? Integer
events The last 24 Hs events Object
events.monitor_id The Id of the monitor Integer
events.timestamp The timestamp of the event Integer
events.type (0 => DOWN Event / 1=> UP Event) Boolean
events.duration The duration of the event, >0 only if type is UP Event Integer

Monitors

Get All Monitors

HTTP Request

GET https://api.pingrely.com/v2/monitors

import requests

url = "https://api.pingrely.com/v2/monitors"

headers = {
    'cache-control': "no-cache"
    }

response = requests.get('https://api.pingrely.com/v2/monitors', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/monitors",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password https://api.pingrely.com/v2/monitors

The above command returns JSON structured like this:

[
  {
    "id": 10,
    "enabled": true,
    "host": "http://www.example.com",
    "name": "Example Monitor",
    "type": "HTTP(s)",
    "time": 5,
    "last_status": true,
    "last_reason": "Last DOWN Reason",
    "group_id": 0
  }
]

Response Attributes

Attribute Description Type
id The unique id of the monitor Integer
enabled true => Monitor is enabled, false => Monitor is paused Boolean
host The FQDN or IP Address of the monitor String
name The monitor’s name String
type The monitor’s type HTTP(s), KEYWORD, FULLPAGE, MAIL, POP3, IMAP4, DNS, FTP, PORT, PING. String
time The interval time in minutes Integer
last_status The current status of the monitor true => Online, false => Offline Boolean
last_reason The last reason the monitor went down String
group_id The unique id of the group the monitor belongs to Integer

Get Monitor Details

HTTP Request

GET https://api.pingrely.com/v2/monitors/{id}

import requests

url = "https://api.pingrely.com/v2/monitors/99"

headers = {
    'cache-control': "no-cache"
    }

response = requests.get('https://api.pingrely.com/v2/monitors/99', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/monitors/99",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password https://api.pingrely.com/v2/monitors/99

The above command returns JSON structured like this:

{
  "id": 99,
  "enabled": true,
  "host": "http://www.example.com",
  "name": "Example Monitor",
  "type": "HTTP(s)",
  "time": 5,
  "last_status": true,
  "last_reason": "",
  "group_id": 0,
  "keyword_exist": false,
  "keywords": null,
  "nameserver": null,
  "expected_ip": null,
  "port": 80,
  "uptime": 99,
  "uptime_7": 100,
  "uptime_30": 100,
  "responsetimes": [
    {
      "timestamp": 1491948593,
      "responsetime": 137
    },
    {
      "timestamp": 1491948293,
      "responsetime": 128
    }

  ],
  "events": [
    {
      "monitor_id": 99,
      "timestamp": 1491948593,
      "type": 1,
      "reason": "HTTP Connect OK",
      "duration": 120
    },
    {
      "monitor_id": 99,
      "timestamp": 1491948473,
      "type": 0,
      "reason": "HTTP Connect Timeout",
      "duration": 0
    }
  ]
}

URL Request Attributes

Attribute Description Type
id The unique id of the new monitor Integer

Response Attributes

Attribute Description Type
id The unique id of the monitor Integer
enabled true => Monitor is enabled, false => Monitor is paused Boolean
host The FQDN or IP Address of the monitor String
name The monitor’s name String
type The monitor’s type HTTP(s), KEYWORD, FULLPAGE, MAIL, POP3, IMAP4, DNS, FTP, PORT, PING. String
time The interval time in minutes Integer
last_status The current status of the monitor true => Online, false => Offline Boolean
last_reason The last reason the monitor went down String
group_id The unique id of the group the monitor belongs to Integer
keyword_exist Check if the keyword exist true or not exist false (KEYWORD Type only) Boolean
keywords The comma separated list of keywords to check on page (KEYWORD type only) String
nameserver The nameserver to check the name resolution of the host (DNS type only) String
expected_ip The expected ip address of the host resolved by the nameserver (DNS type only) String
port The destination port number String
uptime The last 24 hours uptime in % Integer
uptime_7 The last 7 days uptime in % Integer
uptime_30 The last 30 days uptime in % Integer
responsetimes The host response times in milliseconds or seconds for FULLPAGE Integer
responsetimes.timestamp The timestamp the responsetime Integer
responsetimes.responsetime The timestamp in milliseconds or seconds for FULLPAGE Integer
events The last 100 events Object
events.monitor_id The Id of the monitor Integer
events.timestamp The timestamp of the event Integer
events.type (0 => DOWN Event / 1=> UP Event) Boolean
events.duration The duration of the event, >0 only if type is UP Event Integer

Creates a new Monitor

HTTP Request

POST https://api.pingrely.com/v2/monitors

import requests

url = "https://api.pingrely.com/v2/monitors"

headers = {
    'cache-control': "no-cache"
    }

data = {
  "enabled": true,
  "host": "http://www.example.com",
  "name": "Example Monitor",
  "type": "HTTP(s)",
  "time": 5,
  "contacts": [
    {
      "id": 0,
      "name": "New Contact",
      "email": "email@example.com"
    }
  ],
  "group_id": 0
}

response = requests.post('https://api.pingrely.com/v2/monitors', auth=('user@email.com', 'password'), data=data, verify=False)

print(response.text)

$curl = curl_init();

$data = [
  "enabled" => true,
  "host" => "http://www.example.com",
  "name" => "Example Monitor",
  "type" => "HTTP(s)",
  "time" => 5,
  "contacts" => [
    [
      "id" => 0,
      "name" => "New Contact",
      "email" => "email@example.com"
    ]
  ],
  "group_id" => 0
];

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/monitors",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS, $data,
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password -X POST --data "enabled=true&host=http://www.example.com&name=Example Monitor&type=HTTP(s)&time=5" https://api.pingrely.com/v2/monitors

The above command returns JSON structured like this:

{
  "result": true,
  "id": 99
}

Response Attributes

Attribute Description Type
result true if the monitor was created Boolean
id The unique id of the new monitor Integer

Query Parameters (POST Data)

Attribute Description Type
enabled true => Monitor is enabled, false => Monitor is paused Boolean
host The FQDN or IP Address of the monitor String
name The monitor’s name String
type The monitor’s type HTTP(s), KEYWORD, FULLPAGE, MAIL, POP3, IMAP4, DNS, FTP, PORT, PING. String
time The interval time in minutes Integer
contacts The list of the contact alerts to inform to Object
contacts.id The id of the contact Leave 0 to create a new contact Integer
contacts.name The contact name Only if contacts.id==0 String
contacts.email The email of the contact Only if contacts.id==0 String
group_id The unique id of the group the monitor belongs to Leave 0 for Default group Integer
keyword_exist Check if the keyword exist true or not exist false (KEYWORD Type only) Boolean
keywords The comma separated list of keywords to check on page (KEYWORD type only) String
nameserver The nameserver to check the name resolution of the host (DNS type only) String
expected_ip The expected ip address of the host resolved by the nameserver (DNS type only) String
port The destination port number String

Edit a Monitor

HTTP Request

PUT https://api.pingrely.com/v2/monitors/{id}

import requests

url = "https://api.pingrely.com/v2/monitors/99"

headers = {
    'cache-control': "no-cache"
    }

data = {
  "name": "Edited Monitor",
}

response = requests.post('https://api.pingrely.com/v2/monitors/99', auth=('user@email.com', 'password'), data=data, verify=False)

print(response.text)

$curl = curl_init();

$data = [
  "name" => "Edited Monitor",
];

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/monitors/99",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS, $data,
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password -X PUT --data "name=Edited Monitor" https://api.pingrely.com/v2/monitors/99

The above command returns JSON structured like this:

{
  "result": true,
  "id": 99
}

URL Request Attributes

Attribute Description Type
id The unique id of the new monitor Integer

Query Parameters (PUT Data)

Attribute Description Type
enabled true => Monitor is enabled, false => Monitor is paused Boolean
host The FQDN or IP Address of the monitor String
name The monitor’s name String
time The interval time in minutes Integer
contacts The list of the contact alerts to inform to Object
contacts.id The id of the contact Leave 0 to create a new contact Integer
contacts.name The contact name Only if contacts.id==0 String
contacts.email The email of the contact Only if contacts.id==0 String
group_id The unique id of the group the monitor belongs to Leave 0 for Default group Integer
keyword_exist Check if the keyword exist true or not exist false (KEYWORD Type only) Boolean
keywords The comma separated list of keywords to check on page (KEYWORD type only) String
nameserver The nameserver to check the name resolution of the host (DNS type only) String
expected_ip The expected ip address of the host resolved by the nameserver (DNS type only) String
port The destination port number String

Response Attributes

Attribute Description Type
result true if the monitor was edited Boolean
id The unique id of the new monitor Integer

Delete a Monitor

HTTP Request

DELETE https://api.pingrely.com/v2/monitors/{id}

import requests

url = "https://api.pingrely.com/v2/monitors/99"

headers = {
    'cache-control': "no-cache"
    }

response = requests.delete('https://api.pingrely.com/v2/monitors/99', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/monitors/99",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password -X DELETE https://api.pingrely.com/v2/monitors/99

The above command returns HTTP 200

URL Request Attributes

Attribute Description Type
id The unique id of the new monitor Integer

Contacts

Get All Contacts

HTTP Request

GET https://api.pingrely.com/v2/contacts

import requests

url = "https://api.pingrely.com/v2/contacts"

headers = {
    'cache-control': "no-cache"
    }

response = requests.get('https://api.pingrely.com/v2/contacts', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/contacts",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password https://api.pingrely.com/v2/contacts

The above command returns JSON structured like this:

[
  {
    "id": 10,
    "name": "Example Contact",
    "email": "email@example.com"
  }
]

Response Attributes

Attribute Description Type
id The unique id of the contact Integer
name The contact’s name String
email The contact’s email String

Creates a new Contact

HTTP Request

POST https://api.pingrely.com/v2/contacts

import requests

url = "https://api.pingrely.com/v2/contacts"

headers = {
    'cache-control': "no-cache"
    }

data = {
  "name": "Example Contact",
  "email": "email@example.com"
}

response = requests.post('https://api.pingrely.com/v2/contacts', auth=('user@email.com', 'password'), data=data, verify=False)

print(response.text)

$curl = curl_init();

$data = [
  "name" => "Example Contact",
  "email" => "email@example.com"
];

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/contacts",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS, $data,
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password -X POST --data "name=Example Contact&email=email@example.com" https://api.pingrely.com/v2/contacts

The above command returns JSON structured like this:

{
  "result": true,
  "id": 99
}

Response Attributes

Attribute Description Type
result true if the contact was created Boolean
id The unique id of the new contact Integer

Query Parameters (POST Data)

Attribute Description Type
name The contact’s name String
email The contact’s email String

Edit a Contact

HTTP Request

PUT https://api.pingrely.com/v2/contacts/{id}

import requests

url = "https://api.pingrely.com/v2/contacts/99"

headers = {
    'cache-control': "no-cache"
    }

data = {
  "name": "Edited Contact",
}

response = requests.post('https://api.pingrely.com/v2/contacts/99', auth=('user@email.com', 'password'), data=data, verify=False)

print(response.text)

$curl = curl_init();

$data = [
  "name" => "Edited Contact",
];

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/contacts/99",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS, $data,
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password -X PUT --data "name=Edited Contact" https://api.pingrely.com/v2/contacts/99

The above command returns JSON structured like this:

{
  "result": true,
  "id": 99
}

URL Request Attributes

Attribute Description Type
id The unique id of the contact Integer

Query Parameters (PUT Data)

Attribute Description Type
name The contact’s name String
email The contact’s email String

Response Attributes

Attribute Description Type
result true if the contact was edited Boolean
id The unique id of the edited contact Integer

Delete a Contact

HTTP Request

DELETE https://api.pingrely.com/v2/contacts/{id}

import requests

url = "https://api.pingrely.com/v2/contacts/99"

headers = {
    'cache-control': "no-cache"
    }

response = requests.delete('https://api.pingrely.com/v2/monitors/99', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/contacts/99",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password -X DELETE https://api.pingrely.com/v2/contacts/99

The above command returns HTTP 200

URL Request Attributes

Attribute Description Type
id The unique id of the contact Integer

Groups

Get All Groups

HTTP Request

GET https://api.pingrely.com/v2/groups

import requests

url = "https://api.pingrely.com/v2/groups"

headers = {
    'cache-control': "no-cache"
    }

response = requests.get('https://api.pingrely.com/v2/groups', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/groups",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password https://api.pingrely.com/v2/groups

The above command returns JSON structured like this:

[
  {
    "group_id": 10,
    "name": "Example Group"
  }
]

Response Attributes

Attribute Description Type
group_id The unique id of the group Integer
name The group’s name String

Creates a new Group

HTTP Request

POST https://api.pingrely.com/v2/groups

import requests

url = "https://api.pingrely.com/v2/groups"

headers = {
    'cache-control': "no-cache"
    }

data = {
  "name": "Example Group"
}

response = requests.post('https://api.pingrely.com/v2/groups', auth=('user@email.com', 'password'), data=data, verify=False)

print(response.text)

$curl = curl_init();

$data = [
  "name" => "Example Group"
];

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/groups",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS, $data,
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password -X POST --data "name=Example Group" https://api.pingrely.com/v2/groups

The above command returns JSON structured like this:

{
  "result": true,
  "id": 99
}

Response Attributes

Attribute Description Type
result true if the group was created Boolean
id The unique id of the new group Integer

Query Parameters (POST Data)

Attribute Description Type
name The group’s name String

Edit a Group

HTTP Request

PUT https://api.pingrely.com/v2/groups/{id}

import requests

url = "https://api.pingrely.com/v2/groups/99"

headers = {
    'cache-control': "no-cache"
    }

data = {
  "name": "Edited Group",
}

response = requests.post('https://api.pingrely.com/v2/groups/99', auth=('user@email.com', 'password'), data=data, verify=False)

print(response.text)

$curl = curl_init();

$data = [
  "name" => "Edited Group",
];

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/groups/99",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS, $data,
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password -X PUT --data "name=Edited Group" https://api.pingrely.com/v2/groups/99

The above command returns JSON structured like this:

{
  "result": true,
  "id": 99
}

URL Request Attributes

Attribute Description Type
id The unique id of the group Integer

Query Parameters (PUT Data)

Attribute Description Type
name The group’s name String

Response Attributes

Attribute Description Type
result true if the group was edited Boolean
id The unique id of the edited group Integer

Delete a Group

HTTP Request

DELETE https://api.pingrely.com/v2/groups/{id}

import requests

url = "https://api.pingrely.com/v2/groups/99"

headers = {
    'cache-control': "no-cache"
    }

response = requests.delete('https://api.pingrely.com/v2/groups/99', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/groups/99",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password -X DELETE https://api.pingrely.com/v2/groups/99

The above command returns HTTP 200

URL Request Attributes

Attribute Description Type
id The unique id of the group Integer

Resellers

See more information about our reseller program in Pingrely Resellers

Get Reseller Summary

HTTP Request

GET https://api.pingrely.com/v2/reseller

import requests

url = "https://api.pingrely.com/v2/reseller"

headers = {
    'cache-control': "no-cache"
    }

response = requests.get('https://api.pingrely.com/v2/reseller', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/reseller",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password https://api.pingrely.com/v2/reseller

The above command returns JSON structured like this:

  {
    "name": "Example Reseller",
    "num_users": 10
  }

Response Attributes

Attribute Description Type
name The reseller’s name String
num_users The number of users associated with the reseller Integer

Get Reseller Users

HTTP Request

GET https://api.pingrely.com/v2/reseller/users

import requests

url = "https://api.pingrely.com/v2/reseller/users"

headers = {
    'cache-control': "no-cache"
    }

response = requests.get('https://api.pingrely.com/v2/reseller/users', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/reseller/users",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password https://api.pingrely.com/v2/reseller/users

The above command returns JSON structured like this:

[
  {
    "id": 99,
    "name": "Exmaple User",
    "email": "email@example.com",
    "host": "http://www.primaryhostexample.com",
    "creation_date": 1491948593,
    "plan": "basic",
    "expired": false,
    "trial": false,
    "days_remaining": 0
  }
]

Response Attributes

Attribute Description Type
id The id of the user Integer
name The reseller’s name String
email The email of the user String
host The FQDN or IP Address of the first user monitor String
creation_date The timestamp when the user were created Integer
plan The subscription plan name String
expired true if suscription if expired Boolean
trial true if the user suscription is doing a trial Boolean
days_remaining The days until the trial expires Integer

Get Reseller User Details

HTTP Request

GET https://api.pingrely.com/v2/reseller/users/{id}

import requests

url = "https://api.pingrely.com/v2/reseller/users/99"

headers = {
    'cache-control': "no-cache"
    }

response = requests.get('https://api.pingrely.com/v2/reseller/users/99', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/reseller/users/99",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password https://api.pingrely.com/v2/reseller/users/99

The above command returns JSON structured like this:

  {
    "id": 99,
    "name": "Exmaple User",
    "email": "email@example.com",
    "host": "http://www.primaryhostexample.com",
    "creation_date": 1491948593,
    "plan": "basic",
    "expired": false,
    "trial": false,
    "days_remaining": 0
  }

Response Attributes

Attribute Description Type
id The id of the user Integer
name The reseller’s name String
email The email of the user String
host The FQDN or IP Address of the first user monitor String
creation_date The timestamp when the user were created Integer
plan The subscription plan name String
expired true if suscription if expired Boolean
trial true if the user suscription is doing a trial Boolean
days_remaining The days until the trial expires Integer

Creates a new User

HTTP Request

POST https://api.pingrely.com/v2/reseller/users

import requests

url = "https://api.pingrely.com/v2/reseller/users"

headers = {
    'cache-control': "no-cache"
    }

data = {
  "name": "Example User",
  "email": "email@example.com",
  "host": "http://www.exampleuser.com"
}

response = requests.post('https://api.pingrely.com/v2/reseller/users', auth=('user@email.com', 'password'), data=data, verify=False)

print(response.text)

$curl = curl_init();

$data = [
  "name" => "Example User",
  "email" => "email@example.com",
  "host" => "http://www.exampleuser.com"
];

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/reseller/users",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS, $data,
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password -X POST --data "name=Example User&email=email@example.com&host=http://www.exampleuser.com" https://api.pingrely.com/v2/reseller/users

The above command returns JSON structured like this:

{
  "result": true,
  "id": 99
}

Response Attributes

Attribute Description Type
result true if the user was created Boolean
id The unique id of the new user Integer

Query Parameters (POST Data)

Attribute Description Type
name The user’s name String
email The user’s email String
host The user’s FQDN to monitor String

Delete a User

HTTP Request

DELETE https://api.pingrely.com/v2/reseller/users/{id}

import requests

url = "https://api.pingrely.com/v2/reseller/users/99"

headers = {
    'cache-control': "no-cache"
    }

response = requests.delete('https://api.pingrely.com/v2/reseller/users/99', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/reseller/users/99",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password -X DELETE https://api.pingrely.com/v2/reseller/users/99

The above command returns HTTP 200

URL Request Attributes

Attribute Description Type
id The unique id of the user Integer

Get Reseller Monitors

HTTP Request

GET https://api.pingrely.com/v2/reseller/monitors

import requests

url = "https://api.pingrely.com/v2/reseller/monitors"

headers = {
    'cache-control': "no-cache"
    }

response = requests.get('https://api.pingrely.com/v2/reseller/monitors', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/reseller/monitors",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password https://api.pingrely.com/v2/reseller/monitors

The above command returns JSON structured like this:

[
  {
    "id": 10,
    "enabled": true,
    "host": "http://www.example.com",
    "type": "HTTP(s)",
  }
]

Response Attributes

Attribute Description Type
id The unique id of the monitor Integer
enabled true => Monitor is enabled, false => Monitor is paused Boolean
host The FQDN or IP Address of the monitor String
type The monitor’s type HTTP(s), KEYWORD, FULLPAGE, MAIL, POP3, IMAP4, DNS, FTP, PORT, PING. String

Get Reseller Monitor Details

HTTP Request

GET https://api.pingrely.com/v2/reseller/monitors/{id}

import requests

url = "https://api.pingrely.com/v2/reseller/monitors/99"

headers = {
    'cache-control': "no-cache"
    }

response = requests.get('https://api.pingrely.com/v2/reseller/monitors/99', auth=('user@email.com', 'password'), verify=False)

print(response.text)

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.pingrely.com/v2/reseller/monitors/99",
  CURLOPT_USERPWD => "username@email.com:password",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
# With shell, you can just pass the correct username:password with each request
curl -u username:password https://api.pingrely.com/v2/reseller/monitors/99

The above command returns JSON structured like this:

{
  "id": 99,
  "enabled": true,
  "host": "http://www.example.com",
  "name": "Example Monitor",
  "type": "HTTP(s)",
  "last_status": true,
  "last_reason": "",
  "uptime": 99,
  "uptime_7": 100,
  "uptime_30": 100,
  "responsetimes": [
    {
      "timestamp": 1491948593,
      "responsetime": 137
    },
    {
      "timestamp": 1491948293,
      "responsetime": 128
    }

  ],
  "events": [
    {
      "monitor_id": 99,
      "timestamp": 1491948593,
      "type": 1,
      "reason": "HTTP Connect OK",
      "duration": 120
    },
    {
      "monitor_id": 99,
      "timestamp": 1491948473,
      "type": 0,
      "reason": "HTTP Connect Timeout",
      "duration": 0
    }
  ]
}

URL Request Attributes

Attribute Description Type
id The unique id of the monitor Integer

Response Attributes

Attribute Description Type
id The unique id of the monitor Integer
enabled true => Monitor is enabled, false => Monitor is paused Boolean
host The FQDN or IP Address of the monitor String
name The monitor’s name String
type The monitor’s type HTTP(s), KEYWORD, FULLPAGE, MAIL, POP3, IMAP4, DNS, FTP, PORT, PING. String
last_status The current status of the monitor true => Online, false => Offline Boolean
last_reason The last reason the monitor went down String
uptime The last 24 hours uptime in % Integer
uptime_7 The last 7 days uptime in % Integer
uptime_30 The last 30 days uptime in % Integer
responsetimes The host response times in milliseconds or seconds for FULLPAGE Integer
responsetimes.timestamp The timestamp the responsetime Integer
responsetimes.responsetime The timestamp in milliseconds or seconds for FULLPAGE Integer
events The last 100 events Object
events.monitor_id The Id of the monitor Integer
events.timestamp The timestamp of the event Integer
events.type (0 => DOWN Event / 1=> UP Event) Boolean
events.duration The duration of the event, >0 only if type is UP Event Integer

Errors

The Pingrely API uses the following error codes:

Error Code Meaning
400 Bad Request – Your request sucks
401 Unauthorized – Your API key is wrong
403 Forbidden – The kitten requested is hidden for administrators only
404 Not Found – The specified kitten could not be found
405 Method Not Allowed – You tried to access a kitten with an invalid method
406 Not Acceptable – You requested a format that isn’t json
410 Gone – The kitten requested has been removed from our servers
418 I’m a teapot
429 Too Many Requests – You’re requesting too many kittens! Slow down!
500 Internal Server Error – We had a problem with our server. Try again later.
503 Service Unavailable – We’re temporarily offline for maintenance. Please try again later.