Files
RootPanel/DOC/API/READEME.md
2014-03-11 00:35:02 +08:00

20 lines
678 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## API 格式
请求和响应均为 `application/json` 格式。
修改性的请求为 POST 方式,非修改性请求 GET/POST 均可,使用 GET 方式时,用 Query String 来传递参数。
响应代码为 200 表示成功400 表示失败。成功会返回特定的数据,失败的响应会包含错误代号:
{
// 错误代号
"error": "username_exist"
// 根据错误代号不同,可能还有更多字段
}
## 登录验证
登录验证可通过 Cookie 和 HTTP Header 两种方式验证,后者优先级更高。
Cookie 字段名为 `token`, HTTP Header 名为 `X-TOKEN`.
验证失败时会发生 `auth_failed` 错误。