-
Notifications
You must be signed in to change notification settings - Fork 7
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 } |
Creates a new user with admin role privileges. Passwords will be hashed in the database. Users are assigned IDs on creation.
- Can only be used by the admin role
- Usernames must be unique
- Usernames currently cannot be purely numerical
| Request formats | JSON |
| Requires authentication? | Yes, admin only |
| 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" |
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"
}'
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
}