POST
/
api
/
workers
Create a worker
curl --request POST \
  --url http://localhost:3000/api/workers \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "username": "<string>",
  "password": "<string>",
  "position": "<string>",
  "role": "<string>",
  "notificationPreferences": {
    "enabled": true,
    "volume": 0.6,
    "sounds": {
      "low": "soft_pop",
      "medium": "ding",
      "high": "alert",
      "urgent": "alert"
    }
  }
}
'
{
  "success": true,
  "message": "<string>",
  "data": {
    "_id": "<string>",
    "name": "<string>",
    "username": "<string>",
    "position": "<string>",
    "role": "<string>",
    "notificationPreferences": {
      "enabled": true,
      "volume": 0.6,
      "sounds": {
        "low": "soft_pop",
        "medium": "ding",
        "high": "alert",
        "urgent": "alert"
      }
    },
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
name
string
required
Minimum string length: 1
username
string
required
Minimum string length: 1
password
string
required
Minimum string length: 6
position
string
required
Minimum string length: 1
role
string
required

Role ObjectId

Minimum string length: 1
notificationPreferences
object

Response

Worker created

success
boolean
Example:

true

message
string
data
object