Skip to content

Token 生命周期 ​

Token 是 ZundaLink API 的访问凭据。网页会自动保存并验证 Token;自行开发客户端时需要实现同样的失效处理。

获取 Token ​

接口 ​

http
POST /token/get

用户名密码方式 ​

json
{
  "username": "my-user",
  "password": "my-password"
}

二维码或访问码方式 ​

json
{
  "qrcode": "<QR_TEXT>"
}

username/password 与 qrcode 选择一种方式即可。部分网页登录场景允许额外传入 customAimeUrl;不确定时省略。

响应 ​

json
{
  "success": true,
  "msg": "success",
  "token": "<TOKEN>",
  "isMachine": false
}
字段类型说明
tokenstring后续请求使用的 Token
isMachineboolean当前 Token 是否为机台账号

验证 Token ​

接口 ​

http
POST /token/validate

请求体 ​

json
{
  "token": "<TOKEN>"
}

响应 ​

json
{
  "valid": true,
  "token": "<TOKEN>",
  "expires_at": "2026-09-10T00:00:00Z",
  "expired": false
}

expires_at 为 RFC3339 UTC 时间;字段可能随服务状态缺省。以 valid 和 expired 为主要判断依据。

退出 Token ​

接口 ​

http
POST /token/logout

请求体 ​

json
{
  "token": "<TOKEN>"
}

响应 ​

json
{
  "success": true,
  "msg": "success"
}

退出后客户端应清除当前内存中的 Token;如果仍要保留账号条目,也应在下一次使用前重新验证。

cURL 示例 ​

bash
export ZDL_API="https://xn--9er778cb3e.xn--igrr70arr3c.vip/zundalink/api/v0"

curl -X POST "$ZDL_API/token/get" \
  -H "Content-Type: application/json" \
  -d '{"username":"my-user","password":"my-password"}'

curl -X POST "$ZDL_API/token/logout" \
  -H "Content-Type: application/json" \
  -d '{"token":"<TOKEN>"}'

Released under the CC BY-NC-SA 4.0 License.