diff options
| author | mg | 2023-04-25 20:52:45 +0200 |
|---|---|---|
| committer | mg | 2023-04-25 20:52:45 +0200 |
| commit | 13a3ab00761a7aa56780fd5d066e618da102e8c5 (patch) | |
| tree | 96387fbf24d6252673d76e0d0aa13b5400eb1db1 /README.md | |
| parent | ef96c7167a37f320f8cfdb60dcef0c87184333d8 (diff) | |
add swagger (#1)v2
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: https://git.mgrote.net/mg/python-api-server/pulls/1
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 107 |
1 files changed, 20 insertions, 87 deletions
@@ -2,7 +2,6 @@ a small flask-application for storing and downloading stuff like small binaries - ## Variables - ``MAX_CONTENT_LENGTH``: maximal Filesize in MB; defaults to 5MB @@ -11,94 +10,28 @@ a small flask-application for storing and downloading stuff like small binaries ## Example Docker-Compose -see [docker-compose.yml](./docker-compose.yml) - -## API-Endpoints - -### /list - -#### input - -```bash -curl -H "token: myuploadtoken" http://docker10.host.lan:5040/list | jq -``` - -#### output - -```bash -{ - "files": [ - { - "last_modified": "2023-04-13 11:43:51", - "name": "file1", - "size": 1034 - }, - { - "last_modified": "2023-04-13 11:53:59", - "name": "file2", - "size": 5 - }, - { - "last_modified": "2023-04-13 12:41:18", - "name": "file3", - "size": 3478 - } - ] -} -``` - -### /upload - -If a existing file has the same name as the newly uploaded file, it will be overwritten. - -#### input - -```bash -curl -X POST -H "token: myuploadtoken" -F "file=@tests/file" http://docker10.host.lan:5040/upload | jq -``` - -#### output +```yaml +version: '3' +services: + python-api-server: + container_name: httpd-api + image: quotengrote/python-api-server:v2 + ports: + - "5040:5000" + volumes: + - uploads:/uploads + environment: + # FLASK_DEBUG: 1 # for debugging + # FLASK_APP: app # for debugging + MAX_CONTENT_LENGTH: 10 + UPLOAD_DIRECTORY: /uploads + AUTH_TOKEN: myuploadtoken -```bash -{ - "success": "File 'file' successfully uploaded" -} -``` - -### /download - -#### input - -```bash -wget http://docker10.host.lan:5040/download/file -``` - -### /delete - -#### input - -```bash -curl -X DELETE -H "token: myuploadtoken" http://docker10.host.lan:5040/delete/file | jq -``` - -#### output - -```bash -{ - "success": "File 'file' successfully deleted" -} -``` +volumes: + uploads: -### /health - -#### input - -```bash -curl http://docker10.host.lan:5040/health ``` -#### output +## API-Endpoints -```bash -OK -``` +- see [Flasgger](https://github.com/flasgger/flasgger): ``http://<host>:5040/apidocs/`` |