Skip to content

0002 User Management

Quyen Phan edited this page Sep 19, 2018 · 5 revisions

Table of Contents

REST APIs

# HTTP REST API Description
1 GET /api/users Get all available users
2 POST /api/users Register a new user
3 PUT /api/users/{username} Modify information of an user
4 DELETE /api/users/{username} Deactive an user

Details

Get all users

Information

Description Get all available users
HTTP Methods GET
API Pattern /api/users
Request Parameters N/A
Sample http://localhost:8080/api/users
Headers N/A

Request Body

N/A

Response Body

{
  "total":-1,
  "data":[
    {
      "username":"cimela",
      "firstName":"Quyen",
      "lastName":"Quyen",
      "email":"[email protected]"
    }
  ]
}

Register a New User

Information

Description Register a new user
HTTP Methods POST
API Pattern /api/users
Request Parameters N/A
Sample http://localhost:8080/api/users
Headers Content-Type: application/json

Request Body

{
  "username":"cimela",
  "firstName":"Quyen",
  "lastName":"Phan",
  "email":"[email protected]"
}

Response Body

{
  "messageCode":"user.insert.success",
  "params":["5b99070d391b1ca48057f5c2"]
}

Modify Information of an User

Information

Description Modify information of an user
HTTP Methods PUT
API Pattern /api/users/{username}
Request Parameters username: username of user
Sample http://localhost:8080/api/users/cimela
Headers Content-Type: application/json

Request Body

{
  "username":"cimela",
  "firstName":"Quyen",
  "lastName":"Phan",
  "email":"[email protected]"
}

Response Body

{
  "messageCode":"user.update.success",
  "params":["5b99070d391b1ca48057f5c2"]
}