User API
User Listâ
Retrieve the list of users.
GET /api/users
Parametersâ
Authentication required and the user must have global admin permissions.
Return bodyâ
[
{
"id": 6,
"username": "foo",
"email": "foo@zealot.com",
"locale": "en",
"appearance": "dark",
"timezone": "Etc/UTC",
"role": "user"
},
{
"id": 7,
"username": "bar",
"email": "bar@zealot.com",
"locale": "zh-CN",
"appearance": "auto",
"timezone": "Asia/Shanghai",
"role": "developer"
}
]
Current User Detailâ
Retrieve information about the authenticated user.
GET /api/users/me
Return bodyâ
{
"id": 6,
"username": "foo",
"email": "foo@zealot.com",
"locale": "en",
"appearance": "dark",
"timezone": "Etc/UTC",
"role": "user"
}
Search userâ
Search user by email.
GET /api/users/search
Parametersâ
Authentication required and the user must have global admin permissions.
Attribute | Type | Required | Description |
---|---|---|---|
String | true |
Return bodyâ
[
{
"id": 6,
"username": "foo",
"email": "foo@zealot.com",
"locale": "en",
"appearance": "dark",
"timezone": "Etc/UTC",
"role": "user"
},
{
"id": 7,
"username": "bar",
"email": "bar@zealot.com",
"locale": "zh-CN",
"appearance": "auto",
"timezone": "Asia/Shanghai",
"role": "developer"
}
]
Create userâ
Create a user by providing necessary parameters.
Parametersâ
Authentication required and the user must have global admin permissions.
Attribute | Type | Required | Description |
---|---|---|---|
username | String | true | Username |
String | true | User email | |
local | String | false | set user's language, defaults use global setting, options are en/zh-CN |
appearance | String | false | set user's appearance, defaults use global setting, options are light/dark/auto |
timezone | String | false | set user's timezone, defaults use global setting, avaiable value in the values of reference MAPPING constant. |
role | String | false | User role, defaults to "user", options are user/developer/admin |
Return bodyâ
- Return 422 if name is missing or empty.
- Return 201 and response body
{
"id": 8,
"username": "user",
"email": "user@zealot.com",
"locale": "en",
"appearance": "auto",
"timezone": "Etc/GMT+12",
"role": "admin"
}
Edit User Informationâ
Edit the username, email, or role for a specified user ID.
PUT /api/users/:id
Parametersâ
Authentication required and the user must have global admin permissions.
Attribute | Type | Required | Description |
---|---|---|---|
id | String | true | User ID |
username | String | true | Username |
String | true | User email | |
local | String | false | set user's language, defaults use global setting, options are en/zh-CN |
appearance | String | false | set user's appearance, defaults use global setting, options are light/dark/auto |
timezone | String | false | set user's timezone, defaults use global setting, avaiable value in the values of reference MAPPING constant. |
role | String | false | User role, defaults to "user", options are user/developer/admin |
Return bodyâ
{
"id": 6,
"username": "foo",
"email": "foo@zealot.com",
"locale": "en",
"appearance": "light",
"timezone": "America/Los_Angeles",
"role": "user"
}
Destroy userâ
Delete a user from the Zealot system.
DELETE /api/users/:id
Parametersâ
Authentication required and the user must have global admin permissions.
Attribute | Type | Required | Description |
---|---|---|---|
id | Integer | true | User ID |
Return bodyâ
- Return 404 if user not existed.
- Return 200 if success.
Lock userâ
Deactive a user to prevent them from logging in. This is useful when a user leaves the company.
POST /api/users/:id/lock
Parametersâ
Authentication required and the user must have global admin permissions.
Attribute | Type | Required | Description |
---|---|---|---|
id | Integer | true | User ID |
Return bodyâ
- Return 404 if user not existed.
- Return 202 if success.
Unlock userâ
Active a user to allow them to log in.
DELETE /api/users/:id/unlock
Parametersâ
Authentication required and the user must have global admin permissions.
Attribute | Type | Required | Description |
---|---|---|---|
id | Integer | true | User ID |
Return bodyâ
- Return 404 if user not existed.
- Return 202 if success.