-
Notifications
You must be signed in to change notification settings - Fork 0
API: users
luqiuyuan edited this page Jun 7, 2019
·
1 revision
VERB | PATH | DESC |
---|---|---|
GET | /users | show multiple users |
GET | /users/:id | show an user |
POST | /users | create an user |
GET | /user | show the logged-in user |
PATCH/PUT | /user | update the logged-in user |
DELETE | /user | destroy the logged-in user |
see view SHOW
STATUS | ERROR TYPE | DESC | EXAMPLE |
---|---|---|---|
ok (200) | 成功 | ||
not found (404) | 未找到 |
see view SHOW
STATUS | ERROR TYPE | DESC | EXAMPLE |
---|---|---|---|
ok (200) | 成功 | ||
not found (404) | 未找到 |
{
"user": {
"email": "[email protected]",
"password": "Ab123456",
"name": "Dream Future",
"avatar_url": "http://www.bigfish.com",
"description": "Black sheep wall."
}
}
validations
- user (required)
- email (required, max length 255, valid email format)
- password (required, min length 6, max length 50, at least one upcase letter and one downcase letter)
- name (max length 50)
- avatar_url (max length 2000)
- description (max length 60)
see view SHOW
STATUS | ERROR TYPE | DESC | EXAMPLE |
---|---|---|---|
created (201) | 创建成功 | ||
bad request (400) | missing_field | 缺少参数 | { "code": "missing_field", "field": "user:email" } |
invalid_field | 参数错误 | { "code": "invalid_field", "field": "user:password" } |
|
duplicated_field | 重复 | { "code": "duplicated_field", "field": "user:email" } |
see view SHOW
STATUS | ERROR TYPE | DESC | EXAMPLE |
---|---|---|---|
ok (200) | 成功 |
{
"user": {
"email": "[email protected]",
"password": "Ab123456",
"name": "Dream Future",
"avatar_url": "http://www.bigfish.com",
"description": "Black sheep wall."
}
}
validations
- user (required)
- email (max length 255, valid email format)
- password (min length 6, max length 50, at least one upcase letter and one downcase letter)
- name (max length 50)
- avatar_url (max length 2000)
- description (max length 60)
see view SHOW
STATUS | ERROR TYPE | DESC | EXAMPLE |
---|---|---|---|
ok (200) | 成功 | ||
bad request (400) | missing_field | 缺少参数 | { "code": "missing_field", "field": "user" } |
invalid_field | 参数错误 | { "code": "invalid_field", "field": "user:password" } |
|
duplicated_field | 重复 | { "code": "duplicated_field", "field": "user:email" } |
|
not found (404) | 未找到 |
see view INDEX
STATUS | ERROR TYPE | DESC | EXAMPLE |
---|---|---|---|
ok (200) | 成功 |
{
"user": {
"id": 1,
"email": "[email protected]",
"name": "Dream Future",
"avatar_url": "http://www.bigfish.com",
"description": "Black sheep wall.",
"created_at": "2016-05-01T23:00:00.000Z",
"updated_at": "2016-05-01T23:00:00.000Z"
}
}