This is not very important if you do not want to build your own application for reporting product consumptions.
To test the responses quickly, use Postman and create a GET/POST request to the url of a running beerlog server, ensure to set the apikey in the header.
There are two endpoints available:
All API responses are of type application/json.
All successfull requests have at least the following content:
{
"_status": "OK"
}All error responses have the following structure:
{
"_status": "ERR",
"_error": {
"code": "<http-status-code>",
"message": "error description",
}
}Check available free drinks for the given RFID number. This endpoint will only return values for the products for which the apikey has permissions.
Needs the header Authorization: <apikey>.
HTTP 401: HeaderAuthorizationis missing.HTTP 403: Provided apikey inAuthorizationheader is invalid or has not enough permissions.HTTP 404: User with given RFID number does not exist.HTTP 200: Request is valid
Report a product consumption.
Attention! Do report the consumption BEFORE you release the product! See responses below for more information.
Needs the header Authorization: <apikey>.
Needs application/json body with the following structure:
{
"rfid": "<rfid>",
"product": "coffee|beer",
"organisation": "amiv|vis|vmp"
}The available values for keys product and organisation can be found in models/enums.py.
HTTP 401: HeaderAuthorizationis missing.HTTP 403: Provided apikey inAuthorizationheader is invalid, has not enough permissions or the user has used up his free contingent.HTTP 404: User with given RFID number does not exist.HTTP 422: The provided request body is invalid. See key_issuesin the error response body.HTTP 201: Consumption successfully recorded.