Clone
4
User and Role
Shihaam Abdul Rahman edited this page 2024-12-20 02:37:54 +00:00

List existing users

curl "http://localhost:8000/api/v2/account/users" \
  -H "X-API-Key: xmB6rIuSSL9MpZqY678pF"

This will list all users along with their ID

Creating a new user

This is the body to include in the request:

{
  "type": 0,
  "roleId": "admin_id",
  "name": "test12231",
  "password": "tesT1233-123",
  "privilege": {
    "all": false,
    "sites": [
      "66dcddb804aa0d2978cf145f"
    ]
  },
  "alert": false
}

example:

curl "http://localhost:8000/api/v2/account/users" \
  -H 'content-type: application/json' \
  -H "X-API-Key: xmB6rIuSSL9MpZqY678pF" \
   --data-raw '{"type":0,"roleId":"admin_id","name":"test12231","password":"tesT1233-123","privilege":{"all":false,"sites":["66dcddb804aa0d2978cf145f"]},"alert":false}'

Deleting a user

Request type DELETE You will need userid for this request In this example the userid is 6764d103fb5a2a7a6b67c753

curl "http://localhost:8000/api/v2/users/6764d103fb5a2a7a6b67c753" \
  -X 'DELETE' \
  -H 'content-type: application/json' \
  --data-raw '{"forceDelete":true}' \
  -H "X-API-Key: xmB6rIuSSL9MpZqY678pF"

Expected success repose is

{
  "errorCode": 0,
  "msg": "Success."
}