Token|帳號管理

API Domain

https://ioe-api.nextdrive.io/user-management

UMS (User Management Service)

NextDrive Account

① Login

Summary

① Login

Description

Login with account, password, and business code.

Path on service

POST /v1/accounts/login

Request Body

Content Type

application/json

Example Value

JSON
{
  "email": "han.lin@nextdrive.io",
  "password": "test1234",
  "businessCode": "NextDrive"
}

Schema

JSON
{
  "email": "<user email>",
  "password": "<user password>",
  "businessCode": "<business code>"
}


200

Response

Status Code

200

Description


Content Type

application/json

Example Value

JSON
{
  "code": 20000,
  "message": "Successful Request"
  "data": {
      "userUuid": "49ddf050-5c17-4ddf-8834-906ef52d3512",
      "accessToken": "eyJhbGciOiJSUzI1NiIsInR5cGUiOiJKV1QifQ.eyJpYXQiOjE2NjA2MzU5MDMsImlzcyI6Im5leHRkcml2ZS5pbyIsImF1ZCI6Im5leHREcml2ZS9hY2Nlc3NUb2tlbiIsImp0aSI6IjVkNjJlYjNkLTA1M2MtNDgwNS1hNDI3LWZjOWRiNGVjOGMwNyIsImV4cCI6MTY2MDY2NDcwNCwic3ViIjoiNDlkZGYwNTAtNWMxNy00ZGRmLTg4MzQtOTA2ZWY1MmQzNTEyIiwiYXBwVXVpZCI6ImU1ZTJiODIwLWI2ODQtNDZhOS1iMzZlLTgxNWQ4NDQ3Njk1NiIsInBhY2thZ2VOYW1lIjoiaW8ubmV4dGRyaXZlLnRlc3RieWFuZHkuZGV2IiwiY2xpZW50SWQiOiIzZmZodHRpYTZ2OWE3ZXJvb2hyOWc3bnIzNyIsInBvb2xJZCI6ImFwLW5vcnRoZWFzdC0xX0pDVDdNVzdKbSJ9.GX798op2dp_ycQwfWIpX4fJCZWS-eaSz3mx7Te7RuXCTv7mpYS0xlYLyCuz_33oHk3ufwCSY64evU51XNPUJq_hMzz_qq6691av9fTsFS9KT29wHvk-ou8Xy3jTuFNBtAmsvV_UKzPSF1FDoBdeURIUppTW61cHpazIYCGxuf_G5RreHV25am43xq5LXUixIxEmwLcMH4XrT_XAFfY8dbuPkveVVjUbc1ebcXx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blyCERUnBc0Bf-a8bXdvZCmGGL06opXs-j45J188-TSwoI-qJ3H0nfGWZhVGfIXxapYIKPTx0wB7ODbopN9PGyeZwbeyXndYafq432D54mX-KVoKKPJhb3EXEwXeiwqnbWQ0OUKQ8auOUwSlDotORR5DAokzz4UTH3zFfXOTbahMz9ThL3604yu5FHW_PV88r4mzSQYo9xcqxNRjV8fzzcGMQbKdBox8AsEO6mLeT2k4vXE"
  }
}

Schema


400

Response

Status Code

400

Description

Invalid parameter

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40000,
  "message": "Invalid parameter: XXXXXX"
}

Schema

  • Invalid email

  • Invalid pssword

  • Invalid businessCode

403

Response

Status Code

403

Description

Forbidden

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40300,
  "message": "Forbidden: XXXXXX"
}

code could be:

  • 40302: user not found

  • 40306: user account doesn’t have password or password salt

  • 40316: exceed max. attempt of wrong password input

Schema

Other Errors

500

Response

Status Code

500

Description

System error

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 50000,
  "message": "Server error: XXXXXX"
}

Schema

Message can be one off: anything

② Refresh token

Summary

② Refresh token

Description

Refresh token

Path

GET /v1/tokens/refresh-token

Request Header

Description

refresh token

Content Type

application/json

Example Value


JSON
{
  "x-nd-refresh-token": "aaa.bbb.ccc"
}

Schema

The refresh token expires in 30 days. (2592000 / 86400 = 30 days)


200

Response

Status Code

200

Description

Provide an URL for refreshing token

Content Type

application/json

Example Value

{
  "code": 20000,
  "message": "Successful Request"
  "data": {
    "accessToken": "aaa.bbb.ccc"
  }
}

Schema


401

Response

Status Code

401

Description

Unauthorized

Content Type

application/json

Example Value

{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40100,
  "message": "Unauthorized: XXXXXX"
}

Schema

empty or incorrect refresh token

  • Refresh token must NOT be empty

  • Invalid token format.

  • Token was issued after the current time.

  • iat is Not number

  • Token is expired.

  • exp is Not number

  • aud is Not empty

  • aud only allows:

    • nextDrive/accessToken

    • nextDrive/refreshToken

500

Response

Status Code

500

Description

System error

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 50000,
  "message": "Server error: XXXXXX"
}

Schema

Message can be one off: anything

③ Reset passwrod

Summary

③ Reset password

Description

Reset password

Path

PUT /v1/accounts/force-reset-password

Request Body

Description

force-reset-password

Content Type

application/json

Example Value

{
  "email": "example@example.com",
  "password": "example"
}

Schema



200

Response

Status Code

200

Description

 

Content Type

application/json

Example Value

{
  "code": 20000,
  "message": "Successful Request"
  "data": {}
}

Schema

 

400

Response

Status Code

400

Description

Invalid parameter

Content Type

application/json

Example Value

{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40000,
  "message": "Invalid parameter: XXXXXX"
}

Schema

  1. Invalid email format

  2. Invalid password format

299

Response

Status Code

299

Description

Forbidden

Content Type

application/json

Example Value

{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 29901,
  "message": "Forbidden: XXXXXX"
}

Schema

Message can be one off:

  1. WrongUserInfoWithBilledError 29901

  2. UserNotFoundWithBilledError 29902

404

Response

Status Code

404

Description

Resource not found

Content Type

application/json

Example Value

{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40400,
  "message": "Resource not found"
}

Schema

 

500

Response

Status Code

500

Description

System error

Content Type

application/json

Example Value

{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 50000,
  "message": "Server error: XXXXXX"
}

Schema

Message can be one off: any thing

④ Forgot password

Summary

④ Forgot password

Description

Forgot password

Path

POST /v1/accounts/forgot-password

Request Body

Description

forgot password

Content Type

application/json

Example Value

JSON
{
  "email": "example@nextdrive.io",
  "businessCode": "<businessCode>",
  "locale":"<en_US|zh_TW|ja_JP>"
}

Schema

locale is an optional

Note

If the authentication code is entered incorrectly more than 5 times, you will need to wait 30 minutes before you can try again.


200

Response

Status Code

200

Description

To return info for Life+ API authentication

Content Type

application/json

Example Value

JSON
{
  "code": 20000,
  "message": "Successful Request"
  "data": {}
}

Schema


400

Response

Status Code

400

Description

Invalid parameter

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40000,
  "message": "Invalid parameter: XXXXXX"
}

Schema

  1. missing email

  2. missing businessCode

403

Response

Status Code

403

Description

Forbidden

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40300,
  "message": "Forbidden: XXXXXX"
}

Schema


404

Response

Status Code

404

Description

Resource not found

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40400,
  "message": "Resource not found"
}

Schema


500

Response

Status Code

500

Description

System error

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 50000,
  "message": "Server error: XXXXXX"
}

Schema

Message can be one off: any thing

⑤ Confirm forgot password

Summary

⑤ Confirm forgot password

Description

Confirm forgot password

Path

POST /user-management/v1/accounts/confirm-password

Request Body

Description

forgot password

Content Type

application/json

Example Value

JSON
{
  "confirmationCode": "XXXXX",
  "email": "example@example.com",
  "password": "example",
  "businessCode": "<businessCode>"
}

Schema



200

Response

Status Code

200

Description


Content Type

application/json

Example Value

JSON
{
  "code": 20000,
  "message": "Successful Request"
  "data": {}
}

Schema


400

Response

Status Code

400

Description

Invalid parameter

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40000,
  "message": "Invalid parameter: XXXXXX"
}

Schema

  1. missing confirmationCode

  2. missing email

  3. missing password

  4. missing businessCode

403

Response

Status Code

403

Description

Forbidden

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40300,
  "message": "Forbidden: XXXXXX"
}

Schema

Message can be one off:

  1. UserNotFoundError 40302

  2. IncorrectPackageNameError 40303

  3. IncorrectConfirmationCodeError 40306

404

Response

Status Code

404

Description

Resource not found

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40400,
  "message": "Resource not found"
}

Schema


500

Response

Status Code

500

Description

System error

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 50000,
  "message": "Server error: XXXXXX"
}

Schema

Message can be one off: any thing

Account Management

① Create an account by Admin

Summary

① Create an account by Admin

Description

Create an account by Admin

Path on service

POST /v1/accounts/create-account

Permission

Businesss::Admin

Request Body

Description

create an account

Content Type

application/json

Example Value

JSON
{
  "email": "han.lin@nextdrive.io",
  "password": "sdfdf1234",
  "locale":"en_US",
  "isSendEmail": true
}

Schema

JSON
{
  "email": "<user email>",
  "password": "<user password>",
  "locale":"<en_US|zh_TW|ja_JP>",
  "isSendEmail": true | false
}

Note

isSendEmail is optional; default false


200

Response

Status Code

200

Description


Content Type

application/json

Example Value

JSON
{
  "code": 20000,
  "message": "Successful Request"
  "data": {
    "uuid": "<uuid>"
  }
}

Schema


400

Response

Status Code

400

Description

Invalid parameter

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40000,
  "message": "Invalid parameter: XXXXXX"
}

Schema

  • Invalid email

  • Invalid locale

403

Response

Status Code

403

Description

Forbidden

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40300,
  "message": "Forbidden: XXXXXX"
}

Schema

Other Errors

500

Response

Status Code

500

Description

System error

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 50000,
  "message": "Server error: XXXXXX"
}

Schema

Message can be one off: anything

② Get userUuid by email

Summary

② Get userUuid by email

Description

Get userUuid by email

Path on service

POST /v1/accounts/find-one

Permission

Businesss::Admin

Request Body

Description

get the userUuid by email and optional businessCode

Content Type

application/json

Example Value

JSON
{
  "email": "<user email>",
}

Schema

JSON
{
  "email": string,
}


200

Response

Status Code

200

Description


Content Type

application/json

Example Value

JSON
{
  "code": 20000,
  "message": "Successful Request"
  "data": {
    "uuid": "<uuid>"
  }
}

Schema


400

Response

Status Code

400

Description

Invalid parameter

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40000,
  "message": "Invalid parameter: XXXXXX"
}

Schema

Invalid email

401

Response

Status Code

401

Description

Unauthorized

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40100,
  "message": "Unauthorized"
}

Schema

Cannot access due to limited permission.

403

Response

Status Code

403

Description

Forbidden

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40300,
  "message": "Forbidden: XXXXXX"
}

Schema

Other Errors

500

Response

Status Code

500

Description

System error

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 50000,
  "message": "Server error: XXXXXX"
}

Schema

Message can be one off: anything

③ Attach role

Summary

③ Attach role

Description

Attach role to account

Path

PUT /v1/accounts-roles/{role-name}

Permission

Business::Admin - Attach roles for the users of this business

Request Params

Content Type

application/json

Example Value

JSON
"role-name": "Business::Operator"
  • Business::Admin

  • Business::Operator

  • Business::Dealer

Schema

JSON
role-name: string | required

Request Body

Content Type

application/json

Example Value

JSON
{
  "uuids": [
    "77bd5ffe-fc29-46f7-b03e-0f2f80cbf871", 
    "77bd5ffe-fc29-46f7-b03e-0f2f80cbf872"
  ]
}

Schema

JSON
{
  "uuids": ["<uuid list>"]
}


200

Response

Status Code

200

Description


Content Type

application/json

Example Value

JSON
{
  "code": 20000,
  "message": "Successful Request"
  "data": {
    "updatedAccountIds": [1, 2]
  }
}

Schema


400

Response

Status Code

400

Description

Invalid parameter

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40000,
  "message": "Invalid parameter: XXXXXX"
}

Schema

missing uuids

401

Response

Status Code

401

Description

Unauthorized

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40000,
  "message": "Unauthorized"
}

Schema

Cannot attach the role due to limited permission.

403

Response

Status Code

403

Description

Forbidden

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40300,
  "message": "Forbidden: XXXXXX"
}

Schema

  • One of email cannot set to DB.

    • no such email

    • no such role

500

Response

Status Code

500

Description

System error

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 50000,
  "message": "Server error: XXXXXX"
}

Schema

Message can be one off: anything

④ Detach role from account

Summary

④ Detach role from account

Description

Detach role from account

Path

DELETE /v1/accounts-roles/{role-name}

Permission

Business::Admin - Detach roles for the users of this business

Request Params

Content Type

application/json

Example Value

JSON
"role-name": "Business::Operator"
  • Business::Admin

  • Business::Operator

  • Business::Dealer

Schema

JSON
role-name: string | required

Request Body

Content Type

application/json

Example Value

JSON
{
  "uuids": [
    "77bd5ffe-fc29-46f7-b03e-0f2f80cbf871", 
    "77bd5ffe-fc29-46f7-b03e-0f2f80cbf872"
  ]
}

Schema

JSON
{
  "uuids": ["<uuid list>"]
}


200

Response

Status Code

200

Description


Content Type

application/json

Example Value

JSON
{
  "code": 20000,
  "message": "Successful Request"
  "data": {
    "updatedAccountIds": [1, 2]
  }
}
400

Response

Status Code

400

Description

Invalid parameter

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40000,
  "message": "Invalid parameter: XXXXXX"
}

Schema

missing uuids

401

Response

Status Code

401

Description

Unauthorized

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40000,
  "message": "Unauthorized"
}

Schema

Cannot detach the role due to limited permission.

403

Response

Status Code

403

Description

Forbidden

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 40300,
  "message": "Forbidden: XXXXXX"
}

Schema

  • no such email

  • no such role

500

Response

Status Code

500

Description

System error

Content Type

application/json

Example Value

JSON
{
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5",
  "code": 50000,
  "message": "Server error: XXXXXX"
}

Schema

Message can be one off: anything

⑤ Get account list

Summary

⑤ Get account list

Description

Get account list of specific business (can filter by role and userUuid)

Path

POST /v1/accounts/search

Permission

  • Business::Admin

  • Business::Operator

  • Business::Dealer

Request Header

Content-Type

application/json

Request Body

Description

get account list field

Example Value

JSON
{
  "page": 1,                        // optional
  "pageSize": 10,                   // optional
  "filter": {                       // optional
    "role": "Business::Admin",
    "userUuid": "05fda1cc-f1ad-4147-bd72-adbb474146e1"
  }
}
  • Business::Admin

  • Business::Operator

  • Business::Dealer

Schema

JSON
{
  "page": integer                                | optional(default: 1),
  "pageSize": integer(<10|50|100>)               | optional(default: 10),
  "filter": {                                    | optional,
    "role": string(<NextDrive defined role>)     | optional,
    "userUuid": string(UUID format)              | optional,
  }
}
  • if w/o filter, return all accounts in the specific business


200

Response

Status Code

200

Description

Get account list sucessfully

Content Type

application/json

Example Value

JSON
{
  "code": 200,
  "message": "Successful Request",
  "data": {
    "page": 1,
    "totalPages": 10,
    "pageSize": 10,
    "filter": {                       // optional: (depending on request body)                
      role: "Business::Admin"
    },
    "accountList": [
      {
        "userUuid": "05fda1cc-f1ad-4147-bd72-adbb474146e1",
        "email": "test1@nextdrive.com",
        "role": ["Business::Admin", "EndUser"]
      },
      {
        "userUuid": "05fda1cc-f1ad-4147-bd72-adbb474146e2",
        "email": "test2@nextdrive.com",
        "role": ["Business::Admin", "EndUser"]
      }
      ...
    ]
  }
}

Schema

JSON
{
  "code": int,
  "message": string,
  "data": object,
  "page": integer,
  "totalPages": integer,
  "pageSize": integer,
  "userList": array,
  "userUuid": uuid,
  "email": string,
  "filter": object,
  "role": string 
}
400

Response

Status Code

400

Description

Invalid parameter

Content Type

application/json

Example Value

JSON
{
  "code": 40000,
  "message": "Invalid parameter: XXX",
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5"
}

Schema

wrong format businessUuid

401

Response

Status Code

401

Description

Unauthorized

Content Type

application/json

Example Value

JSON
{
    "code": 40100,
    "message": "Unauthorized: permission denied",
    "requestId": "6e200d83-affc-46b1-b4fe-bec02df33f42"
}

Schema

Unauthorized 40100

403

Response

Status Code

403

Description

Forbidden

Content Type

application/json

Example Value

JSON
{
    "code": 40300,
    "message": "EndUser has no permissions",
    "requestId": "d99df63a-9ea3-4455-af7a-276fb1bee1b1"
}

Schema

Forbidden 40300 EndUser has no permissions to access

404

Response

Status Code

404

Description

Resource not found

Content Type

application/json

Example Value

JSON
{
  "code": 40400,
  "message": "Resource not found: {businessUuid}",
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5"
}

Schema

NotFoundError 40400 (businessUuid, businessCode)

500

Response

Status Code

500

Description

System error

Content Type

application/json

Example Value

JSON
{
  "code": 50000,
  "message": "Server error: XXXXXX",
  "requestId": "e867850b-0c81-43f4-ad58-459a54c65ec5"
}

Schema