Add examples in README

This commit is contained in:
2024-09-17 18:56:50 +02:00
parent 267ff6722a
commit 88cafb1228

230
README.md
View File

@ -1,4 +1,234 @@
Elwig Backend
=============
Elwig API
=========
Authorization
-------------
All API endpoints are secured via an HTTP basic authentication.
Base Data
---------
### `GET /wine/varieties`
#### Query Parameters
* `limit`
* `offset`
#### Example
```http
GET /wine/varieties HTTP/1.1
Host: example.com
Accept: application/json
Authorization: Basic dGVzdDp0ZXN0
```
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 3384
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Methods: HEAD, GET, OPTIONS
```
### `GET /wine/quality_levels`
#### Query Parameters
* `limit`
* `offset`
#### Example
```http
GET /wine/quality_levels HTTP/1.1
Host: example.com
Accept: application/json
Authorization: Basic dGVzdDp0ZXN0
```
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 922
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Methods: HEAD, GET, OPTIONS
```
Client Base Data
----------------
### `GET /wine/attributes`
#### Query Parameters
* `limit`
* `offset`
#### Example
```http
GET /wine/attributes HTTP/1.1
Host: example.com
Accept: application/json
Authorization: Basic dGVzdDp0ZXN0
```
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 162
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Methods: HEAD, GET, OPTIONS
```
### `GET /wine/cultivations`
#### Query Parameters
* `limit`
* `offset`
#### Example
```http
GET /wine/cultivations HTTP/1.1
Host: example.com
Accept: application/json
Authorization: Basic dGVzdDp0ZXN0
```
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 205
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Methods: HEAD, GET, OPTIONS
```
### `GET /modifiers`
#### Query Parameters
* `limit`
* `offset`
* `filters`
* `year=<YEAR>[;<YEAR> ...]`
#### Example
```http
GET /modifiers?filters=year=2020 HTTP/1.1
Host: example.com
Accept: application/json
Authorization: Basic dGVzdDp0ZXN0
```
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 282
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Methods: HEAD, GET, OPTIONS
```
Delivery Schedules
------------------
### `GET /delivery_schedules`
#### Query Parameters
* `limit`
* `offset`
* `filters`
* `year=<YEAR>[;<YEAR> ...]`
* `sortid=<SORTID>[;<SORTID> ...]`
* `date=<DATE>[;<DATE> ...]`
#### Example
```http
GET /delivery_schedules?filters=year=2020,sortid=GV;ZW HTTP/1.1
Host: example.com
Accept: application/json
Authorization: Basic dGVzdDp0ZXN0
```
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 10000
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Methods: HEAD, GET, OPTIONS
```
```
Delivery Schedules
------------------
### `GET /delivery_schedules`
#### Query Parameters
* `limit`
* `offset`
* `filters`
* `year=<YEAR>[;<YEAR> ...]`
* `sortid=<SORTID>[;<SORTID> ...]`
* `date=<DATE>[;<DATE> ...]`
#### Example
```http
GET /delivery_schedules?filters=year=2020,sortid=GV;ZW HTTP/1.1
Host: example.com
Accept: application/json
Authorization: Basic dGVzdDp0ZXN0
```
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 10000
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Methods: HEAD, GET, OPTIONS
{"filters":["year=2020","sortid=GV;ZW"],"total":20,"offset":0,"limit":null,"data":[
{"year":2020,"dsnr": 1,"date":"2020-09-01","branch":{"zwstid":"X","name":"Test"},"description":"Grüner Veltliner",
"max_weight":200000,"is_cancelled":false,"announced_weight": 66100,"delivered_weight": 68178,
"announcement_from":null,"announcement_to":null},
{"year":2020,"dsnr": 2,"date":"2020-09-02","branch":{"zwstid":"X","name":"Test"},"description":"Zweigelt",
"max_weight": null,"is_cancelled":false,"announced_weight": 27600,"delivered_weight": 30220,
"announcement_from":null,"announcement_to":"2020-08-31T22:00:00Z"},
...
]}
```