心跳任务
GET https://www.hostmonits.com/api/heartbeats/
curl --request GET \
--url 'https://www.hostmonits.com/api/heartbeats/' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://www.hostmonits.com/api/heartbeats/' \
--header 'Authorization: Bearer {api_key}' \
| 请求参数 | 详情 | 描述 |
|---|---|---|
| search | 选填 字符串 | 搜索关键词. |
| search_by | 选填 字符串 | 搜索匹配字段,可选值:name. |
| is_enabled | 选填 布尔型 | |
| project_id | 选填 整型 | |
| datetime_field | 选填 字符串 | 可选值:datetime, last_datetime, last_run_datetime |
| datetime_start | 选填 字符串 | 起始时间,格式 年-月-日 时:分:秒. |
| datetime_end | 选填 字符串 | 结束时间,格式 年-月-日 时:分:秒. |
| order_by | 选填 字符串 | 排序字段,可选值:heartbeat_id, datetime, last_datetime, last_run_datetime, name, uptime. |
| order_type | 选填 字符串 | 排序方式:ASC 升序,DESC 降序. |
| page | 选填 整型 | 数据页码,默认值 1. |
| results_per_page | 选填 整型 | 每页返回数据条数,可选值:10, 25, 50, 100, 250, 500, 1000,默认值 25. |
{
"data": [
{
"id": 1,
"project_id": 0,
"name": "Demo cron",
"code": "12345678901112131415",
"settings": {
"run_interval": 1,
"run_interval_type": "minutes",
"run_interval_grace": 1,
"run_interval_grace_type": "seconds"
},
"is_ok": 1,
"uptime": 75.5,
"downtime": 24.5,
"total_runs": 50,
"total_missed_runs": 15,
"last_run_datetime": "2021-03-30 19:17:22",
"notifications": {
"email_is_enabled": 0,
"webhook": "",
"slack": "",
"twilio": ""
},
"is_enabled": true,
"datetime": "2026-06-22 06:46:16",
}
],
"meta": {
"page": 1,
"results_per_page": 25,
"total": 1,
"total_pages": 1
},
"links": {
"first": "https://www.hostmonits.com/api/heartbeats?page=1",
"last": "https://www.hostmonits.com/api/heartbeats?page=1",
"next": null,
"prev": null,
"self": "https://www.hostmonits.com/api/heartbeats?page=1"
}
}
GET https://www.hostmonits.com/api/heartbeats/{heartbeat_id}
curl --request GET \
--url 'https://www.hostmonits.com/api/heartbeats/{heartbeat_id}' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://www.hostmonits.com/api/heartbeats/{heartbeat_id}' \
--header 'Authorization: Bearer {api_key}' \
{
"data": {
"id": 1,
"project_id": 0,
"name": "Demo cron",
"code": "12345678901112131415",
"settings": {
"run_interval": 1,
"run_interval_type": "minutes",
"run_interval_grace": 1,
"run_interval_grace_type": "seconds"
},
"is_ok": 1,
"uptime": 75.5,
"downtime": 24.5,
"total_runs": 50,
"total_missed_runs": 15,
"last_run_datetime": "2021-03-30 19:17:22",
"notifications": {
"email_is_enabled": 0,
"webhook": "",
"slack": "",
"twilio": ""
},
"is_enabled": true,
"datetime": "2026-06-22 06:46:16",
}
}
POST https://www.hostmonits.com/api/heartbeats
| 请求参数 | 详情 | 描述 |
|---|---|---|
| name | 必填 字符串 | - |
| run_interval | 选填 整型 | - |
| run_interval_type | 选填 字符串 | 可选值:seconds, minutes, hours, days |
| run_interval_grace | 选填 整型 | - |
| run_interval_grace_type | 选填 字符串 | 可选值:seconds, minutes, hours, days |
| is_ok_notifications | 选填 数组 | 通知渠道ID |
| is_enabled | 选填 布尔型 | - |
curl --request POST \
--url 'https://www.hostmonits.com/api/heartbeats' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'target=example.com' \
--url 'https://www.hostmonits.com/api/heartbeats' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'target=example.com' \
{
"data": {
"id": 1
}
}
POST https://www.hostmonits.com/api/heartbeats/{heartbeat_id}
| 请求参数 | 详情 | 描述 |
|---|---|---|
| name | 选填 字符串 | - |
| run_interval | 选填 整型 | - |
| run_interval_type | 选填 字符串 | 可选值:seconds, minutes, hours, days |
| run_interval_grace | 选填 整型 | - |
| run_interval_grace_type | 选填 字符串 | 可选值:seconds, minutes, hours, days |
| is_ok_notifications | 选填 数组 | 通知渠道ID |
| is_enabled | 选填 布尔型 | - |
curl --request POST \
--url 'https://www.hostmonits.com/api/heartbeats/{heartbeat_id}' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--url 'https://www.hostmonits.com/api/heartbeats/{heartbeat_id}' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
{
"data": {
"id": 1
}
}
DELETE https://www.hostmonits.com/api/heartbeats/{heartbeat_id}
curl --request DELETE \
--url 'https://www.hostmonits.com/api/heartbeats/{heartbeat_id}' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://www.hostmonits.com/api/heartbeats/{heartbeat_id}' \
--header 'Authorization: Bearer {api_key}' \