API 文档
所有接口返回 JSON;除令牌生成和跳转外都需要在请求体或 URL 上传 token。
1. 生成令牌(演示)
POST /api/token/generate
Content-Type: application/json
{ "name": "测试令牌" }
→ { "token": "tk_xxx", "name": "测试令牌", "created_at": 1718000000000, "request_count": 0 }
2. 创建短链
POST /api/links
Content-Type: application/json
{
"base_url": "https://s.vectorac.com",
"token": "tk_xxx",
"target_url": "https://example.com/long/path",
"remark": "可选"
}
→ { "code": "aB3xY7z", "short_url": "https://s.vectorac.com/s/aB3xY7z", "target_url": "...", "token": "tk_xxx" }
3. 跳转
GET https://s.vectorac.com/s/{code}
→ 302 Found, Location: <target_url>
4. 查询统计
GET /api/stats/overview?token=tk_xxx
→ { totals: {...}, trend: { labels:[...], data:[...] }, top:[ ... ] }
5. 列出我的短链
GET /api/links?token=tk_xxx
→ { items: [ { code, short_url, target_url, click_count, ... } ] }
6. 删除短链
DELETE /api/links/{code}
Content-Type: application/json
{ "token": "tk_xxx" }
→ { "ok": true }
7. 管理员视图(全部短链)
GET /api/admin/links?token=Admin2026
DELETE /api/admin/links/{code}
Body: { "token": "Admin2026" }