@saltyang
2017-04-27T03:28:18.000000Z
字数 4469
阅读 806
zhihui
admin/111111。Create channel company and company admin user)来创建公司和公司管理员Upate channel company quota)Get user info)可以获取用户基本信息Login mbk user.
/api/user/ologin/
POST
application/x-www-form-urlencoded
{"grant_type": "passowrd","client_id": "0Oq62d5HeW1sbQ5gD2jF6KBjzizqKsaO7MhBRfR3","client_secret":"6vFeolOrASGD20RYJAuceBktE4UUyPLFfjqS91fV4tZomzh1XNKO4hxe3vXxWpgtEcmamgRUvOhIjT4aJKPQT3HdJ5qx5FyjMA8x2sYs5CNTAeegExkVJvDoANOVqKCz","username": "admin","password": "111111"}
Status Code: 200Body:{"token_type": "*****","access_token": "*****","expiries_in": "*****","expires_at": "*****"}
Status Code: 400
Create channel company and company admin user
/api/user/channel/channel_company/
POST
Bearer {access_token}
{"is_key_managed":true,"company_name":"普亚科技","company_tel":"025-178721788","username":"puya","email": "woods2001@126.com","password":"111111","quota":100,"expired_time":"2017-04-30 00:00:00"}
Status Code: 200 OK
Status Code: 400Body: {"detail": "JSON parse error - Expecting property name enclosed in double quotes: line 6 column 1 (char 167)"}
Update channel company quota
/api/user/channel/channel_company/quota/
POST
Bearer {access_token}
{"cid":6,"quota":150,"expired_time":"2017-05-30 10:00:00"}
Header: 200 OK
Status Code: HTTP_413_REQUEST_ENTITY_TOO_LARGE
Status Code: 406Body: {"ret": 2,"reason": "quota and cid field needed"}
Get user info
/api/user/info/
GET
Bearer {access_token}
Status Code: 200Body:{"email_need_bind": false,"user_type": 5,"devices_used": 1,"user_active": true,"id": 12,"is_email_confirmed": true,"company_name": "南京普亚","email": "salt_yang@puyacn.com","channel": 1,"username": "puya","used": 509874270,"is_cellphone_binded": false,"quota": 0,"cert_status": 5,"is_admin": true,"paid_quota": 96636764160,"nickname": null,"is_key_managed": false,"cellphone": null,"cid": 2,"is_user_active": true,"channel_name": "南京普天","is_email_binded": true}
Update user password
/api/user/${user_id}/
PUT
Bearer {access_token}
{"oldpassword": "111111""password": "puyacn#1.."}
Status Code: 200
Change company status: 1 -> active, 0 -> frozen
/api/user/channel/channel_user/status/
PUT
Bearer {access_token}
{"cid":2,"status":0}
Status Code: 200
- Field error/missed
Status Code: 406body:{"ret": REST_ERR_FIELD_ERR/REST_ERR_FIELD_MISS,"reason": "status field error"/"status field error"}}
It can delete company and company admin user succefully after the company/user has frozened 7 days.
/api/user/channel/channel_user/del/
POST
Bearer {access_token}
{"cid": 2}
Status Code: 200
- user is not channel admin
Status Code: 406body:{"ret": REST_ERR_OPS_VALID,"reason": "user is not channel admin"}
- company is actived
Status Code: 406body:{"ret": REST_ERR_USER_NOT_FROZEN,"reason": "company is actived"}
- The frozend time of company doesn't over 7days
Status Code: 406body:{"ret": REST_ERR_USER_IN_FROZEN,"reason": frozen_duration}
Update cloud storage
/api/storage/cloud/
POST
Bearer {access_token}
{credentials: [{"access_key":"WLG36LHZ1HXERPTRH4H9","access_secret":"qZXfctq9tMZfIJhcULiW4CnuqBqCejsVlEz2X2Du","bucket":"bucket4","url":"116.62.61.218"},{"access_key":"WLG36LHZ1HXERPTRH4H9","access_secret":"qZXfctq9tMZfIJhcULiW4CnuqBqCejsVlEz2X2Du","bucket":"bucket4","url":"116.62.61.218"},{"access_key":"WLG36LHZ1HXERPTRH4H9","access_secret":"qZXfctq9tMZfIJhcULiW4CnuqBqCejsVlEz2X2Du","bucket":"bucket4","url":"116.62.61.218"},{"access_key":"WLG36LHZ1HXERPTRH4H9","access_secret":"qZXfctq9tMZfIJhcULiW4CnuqBqCejsVlEz2X2Du","bucket":"bucket4","url":"116.62.61.218"},{"access_key":"WLG36LHZ1HXERPTRH4H9","access_secret":"qZXfctq9tMZfIJhcULiW4CnuqBqCejsVlEz2X2Du","bucket":"bucket4","url":"116.62.61.218"}]}
Header: 200 OK
Status Code: HTTP_413_REQUEST_ENTITY_TOO_LARGE