[关闭]
@saltyang 2017-04-27T11:28:18.000000Z 字数 4469 阅读 709

Putian Integration API

zhihui


Note


User Login


Description

Login mbk user.

URL

/api/user/ologin/

Method

POST

Content-Type

application/x-www-form-urlencoded

Parameter

  1. {
  2. "grant_type": "passowrd",
  3. "client_id": "0Oq62d5HeW1sbQ5gD2jF6KBjzizqKsaO7MhBRfR3",
  4. "client_secret":"6vFeolOrASGD20RYJAuceBktE4UUyPLFfjqS91fV4tZomzh1XNKO4hxe3vXxWpgtEcmamgRUvOhIjT4aJKPQT3HdJ5qx5FyjMA8x2sYs5CNTAeegExkVJvDoANOVqKCz",
  5. "username": "admin",
  6. "password": "111111"
  7. }

Return - Success

  1. Status Code: 200
  2. Body:
  3. {
  4. "token_type": "*****",
  5. "access_token": "*****",
  6. "expiries_in": "*****",
  7. "expires_at": "*****"
  8. }

Return - Fail

  1. Username or password not correct
  1. Status Code: 400

Create channel company and company admin user


Description

 Create channel company and company admin user

URL

/api/user/channel/channel_company/

Method

POST 

Authorization

Bearer {access_token}

Parameter

  1. {
  2. "is_key_managed":true,
  3. "company_name":"普亚科技",
  4. "company_tel":"025-178721788",
  5. "username":"puya",
  6. "email": "woods2001@126.com",
  7. "password":"111111",
  8. "quota":100,
  9. "expired_time":"2017-04-30 00:00:00"
  10. }

Return - Success

  1. Status Code: 200 OK

Return - Fail

  1. Data format error
  1. Status Code: 400
  2. Body: {
  3. "detail": "JSON parse error - Expecting property name enclosed in double quotes: line 6 column 1 (char 167)"
  4. }

Upate channel company quota


Description

Update channel company quota

URL

/api/user/channel/channel_company/quota/

Method

POST

Authorization

Bearer {access_token}

Parameter

  1. {
  2. "cid":6,
  3. "quota":150
  4. "expired_time":"2017-05-30 10:00:00"
  5. }

Return - Success

  1. Header: 200 OK

Return - Fail

  1. Request quota is over the remain quota of channel
  1. Status Code: HTTP_413_REQUEST_ENTITY_TOO_LARGE
  1. Field Miss/Invalid error
  1. Status Code: 406
  2. Body: {
  3. "ret": 2,
  4. "reason": "quota and cid field needed"
  5. }

Get user info


Description

Get user info

URL

/api/user/info/

Method

GET

Authorization

Bearer {access_token}

Return - Success

  1. Status Code: 200
  2. Body:
  3. {
  4. "email_need_bind": false,
  5. "user_type": 5,
  6. "devices_used": 1,
  7. "user_active": true,
  8. "id": 12,
  9. "is_email_confirmed": true,
  10. "company_name": "南京普亚",
  11. "email": "salt_yang@puyacn.com",
  12. "channel": 1,
  13. "username": "puya",
  14. "used": 509874270,
  15. "is_cellphone_binded": false,
  16. "quota": 0,
  17. "cert_status": 5,
  18. "is_admin": true,
  19. "paid_quota": 96636764160,
  20. "nickname": null,
  21. "is_key_managed": false,
  22. "cellphone": null,
  23. "cid": 2,
  24. "is_user_active": true,
  25. "channel_name": "南京普天",
  26. "is_email_binded": true
  27. }

Update user password


Description

Update user password

URL

/api/user/${user_id}/

Method

PUT

Authorization

Bearer {access_token}

Parameter

  1. {
  2. "oldpassword": "111111"
  3. "password": "puyacn#1.."
  4. }

Return - Success

  1. Status Code: 200

Change company status


Description

Change company status: 1 -> active, 0 -> frozen

URL

/api/user/channel/channel_user/status/

Method

PUT

Authorization

Bearer {access_token}

Parameter

  1. {
  2. "cid":2,
  3. "status":0
  4. }

Return - Success

  1. Status Code: 200

Return - Failed

  • Field error/missed
  1. Status Code: 406
  2. body:
  3. {
  4. "ret": REST_ERR_FIELD_ERR/REST_ERR_FIELD_MISS,
  5. "reason": "status field error"/"status field error"}
  6. }

Delete company


Description

It can delete company and company admin user succefully after the company/user has frozened 7 days.

URL

/api/user/channel/channel_user/del/

Method

POST

Authorization

Bearer {access_token}

Parameter

  1. {
  2. "cid": 2
  3. }

Return - Success

  1. Status Code: 200

Return - Failed

  • user is not channel admin
  1. Status Code: 406
  2. body:
  3. {
  4. "ret": REST_ERR_OPS_VALID,
  5. "reason": "user is not channel admin"
  6. }
  • company is actived
  1. Status Code: 406
  2. body:
  3. {
  4. "ret": REST_ERR_USER_NOT_FROZEN,
  5. "reason": "company is actived"
  6. }
  • The frozend time of company doesn't over 7days
  1. Status Code: 406
  2. body:
  3. {
  4. "ret": REST_ERR_USER_IN_FROZEN,
  5. "reason": frozen_duration
  6. }

Upate cloud storage


Description

Update cloud storage

URL

/api/storage/cloud/

Method

POST

Authorization

Bearer {access_token}

Parameter

  1. {
  2. credentials: [
  3. {
  4. "access_key":"WLG36LHZ1HXERPTRH4H9",
  5. "access_secret":"qZXfctq9tMZfIJhcULiW4CnuqBqCejsVlEz2X2Du",
  6. "bucket":"bucket4",
  7. "url":"116.62.61.218"
  8. },
  9. {
  10. "access_key":"WLG36LHZ1HXERPTRH4H9",
  11. "access_secret":"qZXfctq9tMZfIJhcULiW4CnuqBqCejsVlEz2X2Du",
  12. "bucket":"bucket4",
  13. "url":"116.62.61.218"
  14. },
  15. {
  16. "access_key":"WLG36LHZ1HXERPTRH4H9",
  17. "access_secret":"qZXfctq9tMZfIJhcULiW4CnuqBqCejsVlEz2X2Du",
  18. "bucket":"bucket4",
  19. "url":"116.62.61.218"
  20. },
  21. {
  22. "access_key":"WLG36LHZ1HXERPTRH4H9",
  23. "access_secret":"qZXfctq9tMZfIJhcULiW4CnuqBqCejsVlEz2X2Du",
  24. "bucket":"bucket4",
  25. "url":"116.62.61.218"
  26. },
  27. {
  28. "access_key":"WLG36LHZ1HXERPTRH4H9",
  29. "access_secret":"qZXfctq9tMZfIJhcULiW4CnuqBqCejsVlEz2X2Du",
  30. "bucket":"bucket4",
  31. "url":"116.62.61.218"
  32. }
  33. ]
  34. }

Return - Success

  1. Header: 200 OK

Return - Fail

  1. Request quota is over the remain quota of channel
  1. Status Code: HTTP_413_REQUEST_ENTITY_TOO_LARGE
  1. Field Miss/Invalid error
    ```python
    Status Code: 406
    Body: {
    "ret": 2,
    "reason": "quota and cid field needed"
    }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注