新增 API

This commit is contained in:
jysperm
2014-04-22 17:58:11 +08:00
parent 85b064a89f
commit 6b91908795
6 changed files with 58 additions and 4 deletions

View File

@@ -1,8 +1,6 @@
## API 格式
请求和响应均为 `application/json` 格式。
修改性的请求为 POST 方式,非修改性请求 GET/POST 均可,使用 GET 方式时,用 Query String 来传递参数。
请求和响应均为 `application/json` 格式,大部分 API 均为 POST 方式
响应代码为 200 表示成功400 表示失败。成功会返回特定的数据,失败的响应会包含错误代号:
@@ -17,3 +15,6 @@
登录验证可通过 Cookie 和 HTTP Header 两种方式验证,后者优先级更高。
Cookie 字段名为 `token`, HTTP Header 名为 `X-TOKEN`.
验证失败时会发生 `auth_failed` 错误。
## 分页
limit 和 skip 参数用于分页limit 表示要返回的结果数量skip 表示跳过前若干条结果limit 默认为 30, skip 默认为 0.

View File

@@ -66,3 +66,18 @@ Response Header:
Exception:
* auth_failed
### POST /account/update_passwd/
Request:
{
"old_passwd": "123456",
"new_passwd": "abcdef"
}
No Response.
Exception:
* auth_failed

12
DOC/API/admin.md Normal file
View File

@@ -0,0 +1,12 @@
## Admin API
### POST /admin/update_account/
Request:
{
"account_id": "525284cc2cebb6d0008b4567",
"amount_inc": -1
}
No Response.

View File

@@ -79,3 +79,26 @@ Exception:
* invalid_type
* already_in_status
* invalid_status
### POST /ticket/list/
Request:
{
"type": "linux",
"status": "open/pending/finish/closed",
"limit": 30,
"skip": 0
}
Response:
[
{
"id": "525284cc2cebb6d0008b4567",
"title": "Ticket Title",
"type": "linux",
"status": "open",
"updated_at": "2014-02-18T09:18:27.214Z"
}
]