心跳
GET https://uptime4.com/api/heartbeats/
curl --request GET \
--url 'https://uptime4.com/api/heartbeats/' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://uptime4.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 | 可选的 字符串 | Filter results starting from this datetime. Y-m-d H:i:s format. |
| datetime_end | 可选的 字符串 | Filter results up to this datetime. Y-m-d H:i:s format. |
| 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-04-21 02:07:35",
}
],
"meta": {
"page": 1,
"results_per_page": 25,
"total": 1,
"total_pages": 1
},
"links": {
"first": "https://uptime4.com/api/heartbeats?page=1",
"last": "https://uptime4.com/api/heartbeats?page=1",
"next": null,
"prev": null,
"self": "https://uptime4.com/api/heartbeats?page=1"
}
}
GET https://uptime4.com/api/heartbeats/{heartbeat_id}
curl --request GET \
--url 'https://uptime4.com/api/heartbeats/{heartbeat_id}' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://uptime4.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-04-21 02:07:35",
}
}
POST https://uptime4.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://uptime4.com/api/heartbeats' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'target=example.com' \
--url 'https://uptime4.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://uptime4.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://uptime4.com/api/heartbeats/{heartbeat_id}' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--url 'https://uptime4.com/api/heartbeats/{heartbeat_id}' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
{
"data": {
"id": 1
}
}
DELETE https://uptime4.com/api/heartbeats/{heartbeat_id}
curl --request DELETE \
--url 'https://uptime4.com/api/heartbeats/{heartbeat_id}' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://uptime4.com/api/heartbeats/{heartbeat_id}' \
--header 'Authorization: Bearer {api_key}' \