Added credential functions, minor fixes

Lukas Metzger 2018-01-06 17:27:56 +01:00
parent 3d41813eb0
commit 5d09352730
5 changed files with 114 additions and 6 deletions

@ -4,8 +4,8 @@
| parameter | explanation |
| --- | --- |
| page | The page of the results to return |
| pagesize | How many items should be on each page |
| 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 |
| query | A search query |
| sort | A comma separated list of field names to sort (in this order) combined with the sort order (see example) |

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

106
API-Record-Credentials.md Normal file

@ -0,0 +1,106 @@
# Record credentials
## Get list of credentials
`GET /records/{id}/credentials?page=5&pagesize=10&sort=id-asc,description-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 |
| queryContent | A search query on the record content |
| sort | A comma separated list of field names to sort (in this order) combined with the sort order (see example) |
### Response
| code | result |
| --- | --- |
| 200 | Everything was successful |
```json
{
"paging": {
"page": 5,
"total": 20,
"pagesize": 10
},
"results": [
{
"id": 1,
"description": "This is for what that credential is",
"type": "key|password"
}
]
}
```
## Create new credential
`POST /records/{id}/credentials`
### Body
```json
{
"description": "This is for what that credential is",
"type": "key|password",
"key?": "key if type=key",
"password?": "password if type=password"
}
```
### Response
| code | result |
| --- | --- |
| 201 | Everything was successful, domain has been created |
| 422 | One of the required fields is missing, or key is invalid |
```json
{
"id": 1,
"description": "This is for what that credential is",
"type": "key|password",
"key?": "key if type=key"
}
```
## Delete domain
`DELETE /records/{id}/credentials/{id}`
### Response
| code | result |
| --- | --- |
| 204 | Everything was successful, the answer body is therefore empty |
| 404 | The given record id does not exist |
## Get single credential
`GET /records/{id}/credentials/{id}`
### Response
| code | result |
| --- | --- |
| 200 | Call was successful |
| 404 | The given record id does not exist |
```json
{
"id": 1,
"description": "This is for what that credential is",
"type": "key|password",
"key?": "key if type=key"
}
```
## Update credential
`PUT /records/{id}/credentials/{id}`
### Body
```json
{
"description": "This is for what that credential is",
"type": "key|password",
"key?": "key if type=key",
"password?": "password if type=password"
}
```
### Response
| code | result |
| --- | --- |
| 204 | Everything was successful, the answer body is therefore empty |
| 404 | The given domain id does not exist |
| 422 | One of the required fields is missing, or key is invalid |

@ -4,8 +4,8 @@
| parameter | explanation |
| --- | --- |
| page | The page of the results to return |
| pagesize | How many items should be on each page |
| 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 |
| domain | A comma separated list of domain ids from which records should be returned, if omitted all records accessible by this user are returned |
| queryName | A search query on the record name |
| type | A comma separated list of record types (case insensitive) |

@ -2,4 +2,5 @@
* [[API Functions]]
* [[Sessions | API Sessions]]
* [[Domains | API Domains]]
* [[Records | API Records]]
* [[Records | API Records]]
* [[Credentials | API Record Credentials]]