Purpose

The users route contains all endpoints related to user management and login.

login

This endpoint is used to log the user in. This returns an access_token that can be used in future requests.

Request:
POST /api/v1/login

{
    "name": "admin",
    "secret": "mysupersecretpassword1"
}
PropertyDescriptionType
namename of the userstring
secretusers passwordstring

Response:

{
    "access_token": "9aa1cd4df27bd44b71de575c82968f876c296cd7e451c8633ebd8c64b0dfffaabcdd13891fa1b0c7a8ead6690e9fdfb422a636e5a282727936465db8641ba8bf",
    "user_id": "6b875d6c-7d4e-4ae3-931f-270604df1d7f",
    "first_login": true,
}
PropertyDescriptionType
access_tokenaccess token used for authenticating api requestsstring
user_idid of the user that the access_token belongs toUUIDv4
first_logintrue if this was the first login of the userboolean

You then need to provide the access_token as a cookie called access_token for authenticated API endpoints.

logout

This endpoint is used to log the current session out. This will invalidate the access_token sent in the cookie.

Request:
POST /api/v1/logout

get me

This endpoint is used to get the information about the user that owns the current session.

Request:
POST /api/v1/users/me

Response:

{
    "id": "6b875d6c-7d4e-4ae3-931f-270604df1d7f",
    "name": "Bobby",
    "secret": null,
    "encrypted_secret": null,
    "superuser": true,
    "active": true,
    "last_logon": "2024-06-02T15:27:18.896236Z"
}
PropertyDescriptionType
idid of the currently logged in userUUIDv4
namename of the currently logged in userstring
secretpassword of the currently logged in usernull
encrypted_secretencrypted password of the currently logged in usernull
superuserif the currently logged in user is a superuserboolean
activeif the currently logged in user is activeboolean
last_logontimestampt of the last logon of the currently logged in usertimestamp

get all users

This endpoint is used to get information about all users.
Only superusers are allowed to use this endpoint. Regular users will receive a response with the status code 400.

Request:
POST /api/v1/users/all

Response:

[
    {
        "id": "6b875d6c-7d4e-4ae3-931f-270604df1d7f",
        "name": "Bobby",
        "secret": null,
        "encrypted_secret": null,
        "superuser": true,
        "active": true,
        "last_logon": "2024-06-02T15:27:18.896236Z"
    }
]
PropertyDescriptionType
idid of the userUUIDv4
namename of the userstring
secretpassword of the usernull
encrypted_secretencrypted password of the usernull
superuserif the user is a superuserboolean
activeif the user is activeboolean
last_logontimestampt of the last logon of the usertimestamp

create user

This endpoint is used to create new users.
Only superusers are allowed to use this endpoint. Regular users will receive a response with the status code 400.

Request:
POST /api/v1/users

[
    {
        "name": "Bobby",
        "secret": "my_super_secret_p4ssw0rd",
        "superuser": true
    }
]
PropertyDescriptionType
namename of the userstring
secretpassword of the userstring
superuserif the user is a superuserboolean

update user

This endpoint is used to update existing users.
Only superusers are allowed to use this endpoint. Regular users will receive a response with the status code 400. Note that all the fields in the request body are optional.

Request:
POST /api/v1/users

[
    {
        "name": "Bobby",
        "secret": "my_super_secret_p4ssw0rd",
        "superuser": true
    }
]
PropertyDescriptionType
namename of the userstring?
secretpassword of the userstring?
superuserif the user is a superuserboolean?

update secret

This endpoint is used to change the secret of the currently logged in user.

Request:
PUT /api/v1/users/me/secret

{
    "old_secret": "myoldinsecurepassword",
    "new_secret": "myshinynewpassword1"
}
PropertyDescriptionType
old_secretcurrent password of the userstring
new_secretnew password of the userstring

get dashboards

This endpoint is used to retrieve the dashboards of the currently logged in user.

Request:
GET /api/v1/users/me/dasboards

[
    {
        "id":   "cdf8a7b5-4758-48b0-806e-63df6744e48d",
        "user_id": "6b875d6c-7d4e-4ae3-931f-270604df1d7f",
        "name": "Default",
        "description": "The default Dashboard"
    }
]
PropertyDescriptionType
idid of the dashboardUUIDv4
user_idid of the user owning the dashboardUUIDv4
namename of the dashboardstring
descriptionoptional description of the dashboardstring?