MarkUDown
Monitor API — MarkUDown 页面变更 Webhook API 文档
POST
/api/monitorMonitor
创建一个持久的 URL 监控,按计划检查页面,并在内容变化时通过 POST 发送 webhook 通知。每个订阅在后台独立运行,直到被取消。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| url | string | 必填 | — | 要监控的 URL。 |
| callback_url | string | 必填 | — | 接收变更通知(POST)的 webhook URL。 |
| interval_minutes | integer | 可选 | 60 | 检查页面的间隔(分钟)。 |
| main_content | boolean | 可选 | true | 只比较主要内容(忽略导航和页脚的变化)。 |
| timeout | integer | 可选 | 60 | 页面加载超时时间(秒)。 |
请求
{
"url": "https://books.toscrape.com/",
"callback_url": "https://your-server.com/webhook",
"interval_minutes": 30,
"main_content": true
}响应
// POST /api/monitor — creates subscription
{
"success": true,
"subscription_id": "a1b2c3d4-...",
"url": "https://books.toscrape.com/",
"interval_minutes": 30,
"callback_url": "https://your-server.com/webhook"
}
// Webhook payload on change:
{
"event": "change_detected",
"subscription_id": "a1b2c3d4-...",
"url": "https://books.toscrape.com/",
"changed": true,
"current_hash": "def456...",
"previous_hash": "abc123...",
"checked_at": "2026-04-22T14:30:00Z"
}
// GET /api/monitor — list active subscriptions
// DELETE /api/monitor/{subscription_id} — cancel