MarkUDown

Monitor API — MarkUDown 页面变更 Webhook API 文档

POST/api/monitor

Monitor

创建一个持久的 URL 监控,按计划检查页面,并在内容变化时通过 POST 发送 webhook 通知。每个订阅在后台独立运行,直到被取消。

参数类型必填默认值描述
urlstring必填—要监控的 URL。
callback_urlstring必填—接收变更通知(POST)的 webhook URL。
interval_minutesinteger可选60检查页面的间隔(分钟)。
main_contentboolean可选true只比较主要内容(忽略导航和页脚的变化)。
timeoutinteger可选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