Skip to content

post users

Harmun edited this page May 16, 2019 · 10 revisions

post /users None Create new user with User privileges { userName, pssword } { id, userName, dateCreated }

POST users

Creates a new user with user role privileges. Passwords will be hashed in the database. Users are assigned IDs on creation.

Restrictions

  • Usernames must be unique
  • Usernames currently cannot be purely numerical

Resource Information

Request formats JSON
Requires authentication? No

Fields

Name Required Description Role Example
userName required The created user's username user "SteveRogers1918"
pssword required The password that will be used to authenticate the user user "bucky4ever"

Example Request

curl -X POST \
  http://localhost:3000/users \
  -H 'Content-Type: application/json' \
  -H 'Host: localhost:3000' \
  -d '{
    "userName": "SteveRogers1918",
    "pssword": "bucky4ever"
}'

Example Response

After you post succesfully you should get back the created user's information like this:

{
    "id": 2,
    "userName": "SteveRogers1918",
    "dateCreated": "2019-05-14T10:01:56.000Z"
}

post /admin Admin Create new user with Admin privileges { userName, pssword } { id, userName, role, dateCreated, deletedAt }

POST admin

Creates a new user with admin role privileges. Passwords will be hashed in the database. Users are assigned IDs on creation.

Clone this wiki locally