Create Uptime Monitor
This API allows the creation of a new uptime monitoring resource. It includes key details like name, type, service ID, and conditions. Uptime monitors help track the availability of services and notify users when downtime occurs.

You can configure various options, such as conditions for evaluating the service's health, skipping SSL errors, and following redirects. This enables continuous monitoring and proactive detection of issues.

Common use cases:

  • Website monitoring: Set up an uptime monitor to track a website’s availability and receive alerts if it becomes unreachable.
  • API monitoring: Track API availability, including checking specific response conditions like HTTP status codes or JSON data.


Authorization: Bearer YOUR_TOKEN



Expected Behavior:


  • On success, a new uptime resource will be created, and a confirmation message will be returned.
  • If the request is unauthorized or invalid, an error message will be returned.
Request Body Parameters
  • name string
    The name of the resource (e.g., Pinghome).
  • type string
  • port string
  • data (optional) optional string
  • grace_period positive integer or zero
  • recovery_period positive integer or zero
  • maintenance_cron_expression (optional) string
  • maintenance_duration (optional) positive integer or zero
  • skip_ssl_error boolean
  • not_follow_redirect boolean
  • method string
  • body (optional) string
  • is_advanced boolean
  • headers (optional) string
  • service_id string
  • url or host string
  • conditions (when type is 'http') array of objects
  • regions array of strings
JavaScript
Response codes
const axios = require('axios');

const url = "https://resource-cmd.api.pinghome.io/v1/resource";
const data = {
    "name": "Pinghome",
    "type": "http",
    "port": "",
    "data": "",
    "grace_period": 0,
    "recovery_period": 0,
    "maintenance_cron_expression": "*/8 * * * *",
    "maintenance_duration": 5,
    "skip_ssl_error": false,
    "not_follow_redirect": false,
    "method": "POST",
    "body": "param1=value1&param2=value2",
    "is_advanced": true,
    "headers": { "Authorization": "Bearer sometoken" },
    "service_id": "14ab74bf-87a0-4565-a291-ad5c9733c53f",
    "url": "https://website-stage.ping-home.com",
    "conditions": [{
        "values": ["pinghome"],
        "operator": "equal",
        "type": "response-json-check",
        "key": "groups.user[0].name"
    }],
    "regions": ["eu-central-1"]
};

axios.post(url, data, {
    headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
    }
})
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.error(error);
});
ResponseThis section is used to view the possible HTTP response codes returned by the API. These codes indicate the status of a request, such as 201 (Created), 401 (Unauthorized), 409 (Conflict), or 422 (Unprocessable Entity).