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 {"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJleGFtcGxlLmNvbSIsInN1YiI6InRlc3QiLCJyb2wiOiJleHRlcm5hbCIsImlhdCI6MTc0NTgzMTQzN30.VMLz20aWI8nSd7ocT2W750Cy80OJs8OMiQCtq5Df0rE"} ``` ### `POST /auth` #### Example ```http POST /auth HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json Content-Length: 44 {"username": "test", "password": "password"} ``` ```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 {"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJleGFtcGxlLmNvbSIsInN1YiI6InRlc3QiLCJyb2wiOiJleHRlcm5hbCIsImlhdCI6MTc0NTgzMTQzN30.VMLz20aWI8nSd7ocT2W750Cy80OJs8OMiQCtq5Df0rE"} ``` 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 {"filters":[],"total":44,"offset":0,"limit":null,"data":[ {"sortid":"BL","type":"R","name":"Blauburger","comment":null}, ... {"sortid":"GV","type":"W","name":"Grüner Veltliner","comment":"Weißgipfler"}, ... {"sortid":"WR","type":"W","name":"Welschriesling","comment":null}, ... {"sortid":"ZW","type":"R","name":"Zweigelt","comment":"Blauer Zweigelt, Rotburger"} ]} ``` ### `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 {"filters":[],"total":10,"offset":0,"limit":null,"data":[ {"qualid":"WEI","name":"Wein" ,"min_kmw":null,"is_predicate":false}, {"qualid":"RSW","name":"Rebsortenwein" ,"min_kmw":10.6,"is_predicate":false}, {"qualid":"LDW","name":"Landwein" ,"min_kmw":14.0,"is_predicate":false}, {"qualid":"QUW","name":"Qualitätswein" ,"min_kmw":15.0,"is_predicate":false}, {"qualid":"KAB","name":"Kabinett" ,"min_kmw":17.0,"is_predicate":false}, {"qualid":"SPL","name":"Spätlese" ,"min_kmw":19.0,"is_predicate": true}, {"qualid":"AUL","name":"Auslese" ,"min_kmw":21.0,"is_predicate": true}, {"qualid":"BAL","name":"Beerenauslese" ,"min_kmw":25.0,"is_predicate": true}, {"qualid":"TBA","name":"Trockenbeerenauslese","min_kmw":30.0,"is_predicate": true}, {"qualid":"DAC","name":"DAC" ,"min_kmw":15.0,"is_predicate": true} ]} ``` 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 {"filters":[],"total":3,"offset":0,"limit":null,"data":[ {"attrid":"K" ,"name":"Kabinett"}, {"attrid":"S" ,"name":"Saft"}, {"attrid":"Z" ,"name":"Sekt"} ]} ``` ### `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 {"filters":[],"total":2,"offset":0,"limit":null,"data":[ {"cultid":"KIP","name":"KIP","description":"Kontrollierte Integrierte Produktion"}, {"cultid":"B" ,"name":"Bio","description":"AT-BIO-302"} ]} ``` ### `GET /modifiers` #### Query Parameters * `limit` * `offset` * `filters` * `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 {"filters":["year=2020"],"total":3,"offset":0,"limit":null,"data":[ {"year":2020,"modid":"A" ,"name":"Klasse A" ,"ordering":1}, {"year":2020,"modid":"B" ,"name":"Klasse B" ,"ordering":2}, {"year":2020,"modid":"C" ,"name":"Klasse C" ,"ordering":3} ]} ``` Delivery Schedules ------------------ ### `GET /delivery_schedules` #### Query Parameters * `limit` * `offset` * `filters` * `year=[; ...]` * `sortid=[; ...]` * `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"}, ... ]} ```