docs(api): designed the backup endpoints

This commit is contained in:
antifallobst 2023-09-09 16:58:46 +02:00
parent 3f59c1981f
commit 76f371b6ee
Signed by: antifallobst
GPG Key ID: 2B4F402172791BAF
4 changed files with 87 additions and 3 deletions

View File

@ -40,9 +40,9 @@ __(ND)__ -> Not designed yet.
- [ ] `/delete` (ND)
- `/admin`
- `/backup`
- [ ] `/list` (ND)
- [ ] `/fetch/{id}` (ND)
- [ ] `/create` (ND)
- [ ] `/list`
- [ ] `/fetch/{id}`
- [ ] `/create`
## Examples
An example _Register -> Verify -> Authenticate -> Delete_ flow.

View File

@ -0,0 +1,49 @@
# `/admin/backup/create` - POST
Creates a new backup.
## HTTP Headers
| Header | Content |
|---------------|--------------------|
| Authorization | `Bearer {token}` |
| Content-Type | `application/json` |
## Content - JSON
This json body defines what will be included in the backup.
```
{
"all": true
/ OR /
/opt/ "NginxConfig": <bool>
/opt/ "MailServer": <bool>
/opt/ "Docker": {
/opt/ "Stacks": [<name/id>] / "all"
/opt/ "Images": [<name/id>] / "all"
/opt/ "Volumes": [<name/id>] / "all"
}
/opt/ "SslCerts": <bool>
}
```
## Responses
### 200 - Success
__Content - JSON:__
| Field | Description |
|---------|----------------------------------|
| backups | A list of (id, timestamp) pairs. |
### 400 - Error: Bad Request
The request was malformed.
### 401 - Error: Unauthorized
The provided auth token doesn't allow you to perform this operation.
### 403 - Error: Forbidden
Blocked for security reasons.
### 404 - Error: Not Found
There was a unknown option in the content.
__Content - JSON:__
| Field | Description |
|---------|-----------------------------------------------------------------------------|
| problem | Tells you where the problem is. Example: "docker/stacks/not_existing_stack" |

View File

@ -0,0 +1,17 @@
# `/admin/backup/fetch/{id}` - GET
Downloads the backup identified by `ìd`.
## HTTP Headers
| Header | Content |
|---------------|--------------------|
| Authorization | `Bearer {token}` |
## Responses
### 200 - Success
__Content - BYTES__
### 401 - Error: Unauthorized
The provided auth token doesn't allow you to perform this operation.
### 403 - Error: Forbidden
Blocked for security reasons.
### 404 - Error: Not Found
There was no backup found with the given id.

18
docs/admin/backup/list.md Normal file
View File

@ -0,0 +1,18 @@
# `/admin/backup/list` - GET
Lists all available backups.
## HTTP Headers
| Header | Content |
|---------------|--------------------|
| Authorization | `Bearer {token}` |
## Responses
### 200 - Success
__Content - JSON:__
| Field | Description |
|---------|----------------------------------|
| backups | A list of (id, timestamp) pairs. |
### 401 - Error: Unauthorized
The provided auth token doesn't allow you to perform this operation.
### 403 - Error: Forbidden
Blocked for security reasons.