Files
elwig-rest-backend/README.md

294 lines
6.9 KiB
Markdown

Elwig Backend
=============
Elwig API
=========
Authorization
-------------
All API endpoints are secured via an HTTP basic authentication.
Additionally, the `/auth` endpoint may be used to obtain a Bearer/JWT token.
### `GET /auth`
#### Example
```http
GET /auth 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: 185
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Methods: HEAD, GET, POST, OPTIONS
```
### `POST /auth`
#### Example
```http
POST /auth HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/json
Content-Length: 44
```
```http
POST /auth HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Content-Length: 31
username=test&password=password
```
```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 185
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Methods: HEAD, GET, POST, OPTIONS
```
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
```