Hop til hovedindhold

Sub-users

Sub-users are users for your API. While you can use your super-user for single user projects, it is a good idea to create sub-users for projects involving multiple users, which can be granted different privileges in the database.

Create a new sub-user

Create a new sub-user
POST https://api.centia.io/api/v4/users HTTP/1.1
Content-Type: application/json
Authorization: Bearer abc123

{
"name": "joe",
"email": "joe@example.com",
"password": "Abc123!!"
}
Create multiple sub-users
POST https://api.centia.io/api/v4/users HTTP/1.1
Content-Type: application/json
Authorization: Bearer abc123

{
"users": [
{
"name": "joe",
"email": "joe@example.com",
"password": "Abc123!!"
},
{
"name": "peter",
"email": "peter@example.com",
"password": "Abc123!!"
}
]
}

Get sub-users

A single sub-users
GET https://api.centia.io/api/v4/users/joe,peter HTTP/1.1
Accept: application/json; charset=utf-8
Authorization: Bearer abc123
A all sub-users
GET https://api.centia.io/api/v4/users HTTP/1.1
Accept: application/json; charset=utf-8
Authorization: Bearer abc123

Update sub-users

It is not possible to update the collection of all sub-users. Only explicit given sub-users.

Update single sub-users
PATCH https://api.centia.io/api/v4/users/joe,peter HTTP/1.1
Content-Type: application/json
Authorization: Bearer abc123

{
"user_group": "planning"
}

Delete sub-users

It is not possible to delete the collection of all sub-users. Only explicit given sub-users.

Delete single sub-users
DELETE https://api.centia.io/api/v4/users/joe,peter HTTP/1.1
Accept: application/json; charset=utf-8
Authorization: Bearer abc123