Skip to content

post admin

Harmun edited this page May 15, 2019 · 1 revision

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.

Restrictions

  • Can only be used by the admin role
  • Usernames must be unique
  • Usernames currently cannot be purely numerical

Resource Information

Request formats JSON
Requires authentication? Yes, admin only

Fields

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

Example Request

curl -X POST \
  http://localhost:3000/admin \
  -H 'Authorization: Bearer 123testtoken123' \
  -H 'Content-Type: application/json' \
  -H 'Host: localhost:3000' \
  -d '{
	"userName" : "loki",
	"pssword" : "tesseractbriefcase"
}'

Example Response

After you post successfully you should get back the created admin's information like this:

{
    "id": 2,
    "userName": "loki",
    "role": "admin",
    "dateCreated": "2019-05-15T08:44:29.000Z",
    "deletedAt": null
}

Clone this wiki locally