Added user permission API

Lukas Metzger 2018-02-09 16:45:48 +01:00
parent a6996001da
commit 8dff357cc7
3 changed files with 60 additions and 2 deletions

@ -31,4 +31,5 @@ This documentation documents the API in version 1. All URLs are relative to `/ap
* [[Domains | API Domains]]
* [[Records | API Records]]
* [[Credentials | API Record Credentials]]
* [[Users | API Users]]
* [[Users | API Users]]
* [[Permissions | API Users Permissions]]

56
API-Users-Permissions.md Normal file

@ -0,0 +1,56 @@
# User permissions
## Get list of permissions
`GET /users/{id}/permissions?page=5&pagesize=10`
| 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 |
### Response
| code | result |
| --- | --- |
| 200 | Everything was successful |
```json
{
"paging": {
"page": 5,
"total": 20,
"pagesize": 10
},
"results": [
{
"domainId": 1,
"domainName": "example.com"
}
]
}
```
## Add new permission
`POST /users/{id}/permissions`
### Body
```json
{
"domainId": 1
}
```
### Response
| code | result |
| --- | --- |
| 204 | Everything was successful, the answer body is therefore empty |
| 422 | One of the required fields is missing, or key is invalid |
## Remove permission
`DELETE /users/{id}/permissions/{domainId}`
### Response
| code | result |
| --- | --- |
| 204 | Everything was successful, the answer body is therefore empty |
| 404 | The given record id does not exist |

@ -4,4 +4,5 @@
* [[Domains | API Domains]]
* [[Records | API Records]]
* [[Credentials | API Record Credentials]]
* [[Users | API Users]]
* [[Users | API Users]]
* [[Permissions | API Users Permissions]]