service_id
and name
in the request body. This resource acts as a check-in point for recurring jobs or processes that are expected to send heartbeat signals at defined intervals.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);
});
heartbeat_ids
as query parameters. This bulk operation is useful when cleaning up unused, test, or deprecated heartbeat monitors from your monitoring system.const axios = require('axios');
const url = 'https://resource-cmd.api.pinghome.io/v1/heartbeat?id=6766163a-568d-47b4-a1fa-91a0957e06d4&id=c03b02ec-244f-4d2c-8f68-3910071ed5c8';
axios.delete(url, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
heartbeat_id
as a path parameter. Once deleted, the associated check-in URL becomes inactive, and no further heartbeat pings will be accepted for that resource.const axios = require('axios');
const url = 'https://resource-cmd.api.pinghome.io/v1/heartbeat/c03b02ec-244f-4d2c-8f68-3910071ed5c8';
axios.delete(url, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
service_id
in the path. This endpoint returns a paginated list of heartbeats, helping you understand which recurring jobs, scripts, or processes are currently being tracked under that service.limit
and page
to control pagination and manage large sets of heartbeat monitors efficiently.const axios = require('axios');
const url = 'https://resource-query.api.pinghome.io/v1/service/cc7e4e8b-417d-4be0-9bde-85e353a20fa4/heartbeats?page=1&limit=50';
axios.get(url, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
heartbeat_id
in the path and submitting the updated values in the request body. You can modify fields such as the name
or the interval
that determines when a missed heartbeat should be treated as a failure.const axios = require('axios');
const url = 'https://resource-cmd.api.pinghome.io/v1/heartbeat/906a3444-15ce-4410-8041-89a238e9e91f';
const data = {
name: 'My heartbeat',
service_id: 'cc7e4e8b-417d-4be0-9bde-85e353a20fa4',
methods: ['GET'],
interval: 60,
enabled: true
};
axios.put(url, data, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
heartbeat_id
in the path. The response includes key details such as the monitor’s name, associated service, interval setting.const axios = require('axios');
const url = 'https://resource-query.api.pinghome.io/v1/heartbeat/445a5c1f-c0eb-403a-96d7-3976e5dc74ed';
axios.get(url, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
heartbeat_id
in the path. Use query parameters such as start_date
, end_date
, and interval
to define the time range and level of detail for the data.tick_count
— Number of expected heartbeat intervals during that period.run_count
— Number of actual check-ins (pings) received.fail_count
— Number of intervals that were missed and counted as failures.complete_count
— Number of successful intervals (with timely pings).received_at
— Timestamp of the recorded data point.const axios = require('axios');
const url = "https://statistic-query.api.pinghome.io/v1/heartbeat/47f84f9f-a742-4ef9-be40-e7d7a6fa4039/statistic?interval=7d&start_date=2022-04-03T21:00:00Z&end_date=2022-04-03T22:04:00Z";
axios.get(url, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
heartbeat_id
in the path. This endpoint returns a list of recorded heartbeat events, allowing you to track when check-ins were received and whether they were successful or missed.limit
to control the number of results and last_received_at
to fetch events after a specific timestamp, which is useful for pagination or incremental analysis.const axios = require('axios');
const url = "https://statistic-query.api.pinghome.io/v1/heartbeat/47f84f9f-a742-4ef9-be40-e7d7a6fa4039/events?limit=10&last_received_at=2023-03-27T09:57:54Z";
axios.get(url, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
heartbeat_id
in the path. You can also include an optional result
(e.g., success, fail) and a custom message
in the request body to describe the event outcome.fail
result to indicate that a job ran but encountered an issue.const axios = require('axios');
const url = 'https://data-gateway.api.pinghome.io/v1/heartbeat/{id}';
axios.get(url, {
params: {
result: 'tick',
message: 'Tick event sent'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});