-
Notifications
You must be signed in to change notification settings - Fork 50
API Users
Lukas Metzger edited this page Apr 5, 2018
·
8 revisions
Where not otherwise noted all calls in this section can only be used by admin users.
GET /users?page=5&pagesize=10&query=foo&type=admin,user&sort=id-asc,name-desc,type-asc
| parameter | explanation |
|---|---|
| page | The page of the results to return, if ommited returns page 1 |
| pagesize | How many items should be on each page, if ommited page size is infinite therefore all results are returned |
| type | Types of the retrieved users comma separated |
| query | A search query |
| sort | A comma separated list of field names to sort (in this order) combined with the sort order (see example) |
| code | result |
|---|---|
| 200 | Everything was successful |
{
"paging": {
"page": 5,
"total": 20,
"pagesize": 10
},
"results": [
{
"id": 1,
"name": "administrator",
"type": "admin",
"native": true
}
]
}POST /users
This will create a native user.
{
"name": "administrator",
"type": "admin",
"password": "supersecretpassword"
}| code | result |
|---|---|
| 201 | Everything was successful, user has been created |
| 400 | If type is invalid |
| 409 | A user with that name already exists |
| 422 | One of the required fields is missing |
{
"id": 21,
"name": "administrator",
"type": "admin"
}DELETE /users/{id}
Will work for any user. But users from a not native backend can relogin if they exist there.
| code | result |
|---|---|
| 204 | Everything was successful, the answer body is therefore empty |
| 404 | The given user id does not exist |
GET /users/{id}
This call with me as id (/users/me) can be called by any user and refers to the current user.
| code | result |
|---|---|
| 200 | Call was successful |
| 404 | The given user id does not exist |
{
"id": 1,
"name": "administrator",
"type": "admin",
"native": true
}PUT /users/{id}
This call with me as id (/users/me) can be called by any user and refers to the current user. In this case only the password property is valid.
Name and password are only valid for native users for others they are ignored. Type can be changed for any user.
{
"name?": "administrator",
"type?": "admin",
"password?": "supersecretpassword"
}| code | result |
|---|---|
| 204 | Everything was successful, the answer body is therefore empty |
| 404 | The given user id does not exist |
| 409 | A user with that name already exists |