spc-pleroma/docs/Admin-API.md

208 lines
3.4 KiB
Markdown
Raw Normal View History

2018-12-31 11:13:17 +00:00
# Admin API
2019-02-27 00:08:03 +00:00
2018-12-31 11:13:17 +00:00
Authentication is required and the user must be an admin.
2019-02-27 00:08:03 +00:00
## `/api/pleroma/admin/users`
### List users
- Method `GET`
2019-03-02 14:32:46 +00:00
- Params:
- `page`: **integer** page number
- `page_size`: **integer** number of users per page (default is `50`)
2019-02-27 00:08:03 +00:00
- Response:
```JSON
2019-03-02 14:32:46 +00:00
{
"page_size": integer,
"count": integer,
"users": [
2019-02-27 00:08:03 +00:00
{
2019-03-02 14:32:46 +00:00
"deactivated": bool,
"id": integer,
"nickname": string
2019-02-27 00:08:03 +00:00
},
...
2019-03-02 14:32:46 +00:00
]
}
2019-02-27 00:08:03 +00:00
```
2019-03-02 14:32:46 +00:00
## `/api/pleroma/admin/users/search?query={query}&local={local}&page={page}&page_size={page_size}`
2019-03-01 14:34:14 +00:00
2019-03-01 17:13:02 +00:00
### Search users by name or nickname
2019-03-01 14:34:14 +00:00
- Method `GET`
- Params:
2019-03-01 17:13:02 +00:00
- `query`: **string** search term
- `local`: **bool** whether to return only local users
2019-03-02 14:32:46 +00:00
- `page`: **integer** page number
- `page_size`: **integer** number of users per page (default is `50`)
2019-03-01 14:34:14 +00:00
- Response:
```JSON
2019-03-02 14:32:46 +00:00
{
"page_size": integer,
"count": integer,
"users": [
2019-03-01 14:34:14 +00:00
{
2019-03-02 14:32:46 +00:00
"deactivated": bool,
"id": integer,
"nickname": string
2019-03-01 14:34:14 +00:00
},
...
2019-03-02 14:32:46 +00:00
]
}
2019-03-01 14:34:14 +00:00
```
2018-12-31 11:13:17 +00:00
## `/api/pleroma/admin/user`
2019-02-27 00:08:03 +00:00
2018-12-31 11:13:17 +00:00
### Remove a user
2019-02-27 00:08:03 +00:00
- Method `DELETE`
- Params:
- `nickname`
- Response: Users nickname
2018-12-31 11:13:17 +00:00
### Create a user
2019-02-27 00:08:03 +00:00
- Method: `POST`
- Params:
- `nickname`
- `email`
- `password`
- Response: Users nickname
## `/api/pleroma/admin/users/:nickname/toggle_activation`
### Toggle user activation
- Method: `PATCH`
- Params:
- `nickname`
- Response: Users object
```JSON
{
2019-03-02 14:32:46 +00:00
"deactivated": bool,
"id": integer,
"nickname": string
2019-02-27 00:08:03 +00:00
}
```
2018-12-31 11:13:17 +00:00
## `/api/pleroma/admin/users/tag`
2019-02-27 00:08:03 +00:00
2018-12-31 11:13:17 +00:00
### Tag a list of users
2019-02-27 00:08:03 +00:00
- Method: `PUT`
- Params:
- `nickname`
- `tags`
2018-12-31 11:13:17 +00:00
### Untag a list of users
2019-02-27 00:08:03 +00:00
- Method: `DELETE`
- Params:
- `nickname`
- `tags`
2018-12-31 11:13:17 +00:00
## `/api/pleroma/admin/permission_group/:nickname`
2019-02-27 00:08:03 +00:00
2018-12-31 11:13:17 +00:00
### Get user user permission groups membership
2019-02-27 00:08:03 +00:00
- Method: `GET`
- Params: none
- Response:
2018-12-31 11:13:17 +00:00
```JSON
{
2019-03-02 14:32:46 +00:00
"is_moderator": bool,
"is_admin": bool
2018-12-31 11:13:17 +00:00
}
```
## `/api/pleroma/admin/permission_group/:nickname/:permission_group`
2019-02-27 00:08:03 +00:00
2018-12-31 11:13:17 +00:00
Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesnt exist.
### Get user user permission groups membership
2019-02-27 00:08:03 +00:00
- Method: `GET`
- Params: none
- Response:
2018-12-31 11:13:17 +00:00
```JSON
{
2019-03-02 14:32:46 +00:00
"is_moderator": bool,
"is_admin": bool
2018-12-31 11:13:17 +00:00
}
```
2019-02-27 00:08:03 +00:00
2018-12-31 11:13:17 +00:00
### Add user in permission group
2019-02-27 00:08:03 +00:00
- Method: `POST`
- Params: none
- Response:
- On failure: `{"error": "…"}`
- On success: JSON of the `user.info`
2018-12-31 11:13:17 +00:00
### Remove user from permission group
2019-02-27 00:08:03 +00:00
- Method: `DELETE`
- Params: none
- Response:
- On failure: `{"error": "…"}`
- On success: JSON of the `user.info`
- Note: An admin cannot revoke their own admin status.
2018-12-31 11:13:17 +00:00
## `/api/pleroma/admin/activation_status/:nickname`
### Active or deactivate a user
2019-02-27 00:08:03 +00:00
- Method: `PUT`
- Params:
- `nickname`
- `status` BOOLEAN field, false value means deactivation.
2018-12-31 11:13:17 +00:00
## `/api/pleroma/admin/relay`
2019-02-27 00:08:03 +00:00
2018-12-31 11:13:17 +00:00
### Follow a Relay
2019-02-27 00:08:03 +00:00
- Methods: `POST`
- Params:
- `relay_url`
- Response:
- On success: URL of the followed relay
2018-12-31 11:13:17 +00:00
### Unfollow a Relay
2019-02-27 00:08:03 +00:00
- Methods: `DELETE`
- Params:
- `relay_url`
- Response:
- On success: URL of the unfollowed relay
2018-12-31 11:13:17 +00:00
## `/api/pleroma/admin/invite_token`
2019-02-27 00:08:03 +00:00
2018-12-31 11:13:17 +00:00
### Get a account registeration invite token
2019-02-27 00:08:03 +00:00
- Methods: `GET`
- Params: none
- Response: invite token (base64 string)
2018-12-31 11:13:17 +00:00
## `/api/pleroma/admin/email_invite`
2019-02-27 00:08:03 +00:00
2018-12-31 11:13:17 +00:00
### Sends registration invite via email
2019-02-27 00:08:03 +00:00
- Methods: `POST`
- Params:
- `email`
- `name`, optionnal
2018-12-31 11:13:17 +00:00
## `/api/pleroma/admin/password_reset`
2019-02-27 00:08:03 +00:00
2018-12-31 11:13:17 +00:00
### Get a password reset token for a given nickname
2019-02-27 00:08:03 +00:00
- Methods: `GET`
- Params: none
- Response: password reset token (base64 string)