GET
/health健康检查接口,用于部署平台探活。
curl http://127.0.0.1:3000/health
{ "ok": true }
API Reference
所有接口均返回 JSON。管理类接口需要管理员 token,公开读取和写入接口不需要认证。
/health健康检查接口,用于部署平台探活。
curl http://127.0.0.1:3000/health
{ "ok": true }
/images写入单条图片 URL,并返回自增 ID 与上传时间戳。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
url | string | 是 | 必须是 http 或 https URL |
curl -X POST http://127.0.0.1:3000/images \
-H 'content-type: application/json' \
-d '{"url":"https://example.com/a.jpg"}'
{
"id": 1,
"url": "https://example.com/a.jpg",
"uploaded_at": 1782864000000
}
/images?after_id=0读取图片列表,每页最多 20 条。传入上一页返回的 next_after_id 继续读取。
curl 'http://127.0.0.1:3000/images?after_id=0'
{
"data": [
{ "id": 1, "url": "https://example.com/a.jpg", "uploaded_at": 1782864000000 }
],
"next_after_id": null,
"limit": 20
}
/admin/token?key=...获取管理员 token。首次请求会设置管理员 key,后续必须使用同一个 key。
curl 'http://127.0.0.1:3000/admin/token?key=your-secret-key'
{
"token": "ADMIN_TOKEN",
"expires_at": 1782864600000,
"ttl_seconds": 600
}
/admin/images/delete推荐删除方式,在 body 中携带 token 和目标 ID。
curl -X POST http://127.0.0.1:3000/admin/images/delete \
-H 'content-type: application/json' \
-d '{"token":"ADMIN_TOKEN","id":1}'
{ "deleted": true, "id": 1 }
/images/:idcurl -X DELETE http://127.0.0.1:3000/images/1 \
-H 'authorization: Bearer ADMIN_TOKEN'
/admin/backup配置 WebDAV 自动备份。关闭备份时只需传入 token 和 enabled=false。
curl -X POST http://127.0.0.1:3000/admin/backup \
-H 'content-type: application/json' \
-d '{
"token":"ADMIN_TOKEN",
"enabled":true,
"webdav_url":"https://dav.example.com/backups/",
"username":"user",
"password":"pass"
}'
{ "ok": true, "enabled": true }