Setup Heartbeat Monitor
This API endpoint allows you to create a new heartbeat resource.The user must provide the service_id and name for the heartbeat resource in the request body. This heartbeat will allow the monitoring of service uptime.

This endpoint helps users track the operational status of services by creating a heartbeat resource, which periodically checks the service’s status. If the service becomes unresponsive, the user will be alerted based on the heartbeat configuration.

Common use cases:

  • Service monitoring: Create a heartbeat resource to ensure that a critical service is regularly checked and downtime is quickly detected.
  • Operational health monitoring: Set up a heartbeat to receive alerts if the monitored service fails to respond at scheduled intervals.


Authorization: Bearer YOUR_TOKEN

Request Body Parameters
  • service_id string
    The unique service ID associated with the heartbeat resource.
    Example: '6766163a-568d-47b4-a1fa-91a0957e06d4'
  • name string
  • interval integer
  • enabled boolean
JavaScript
Response codes
const axios = require('axios');

const url = 'https://resource-cmd.api.pinghome.io/v1/heartbeat';
const data = {
  service_id: '6766163a-568d-47b4-a1fa-91a0957e06d4',
  name: 'Pinghome',
  interval: 60,
  enabled: true
};

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).