diff --git a/README.md b/README.md index 4f2cb80861d6beeada42adf9702535b863389479..d73479448bbf60988fbb985c6f60f34c2ceb5d47 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ docker compose down ## All API Functions In this section all API-Functions will be presented with an example call! + + ### GET JWT-Token Use the Result-Token for all marked API-Functions! ``` @@ -33,9 +35,46 @@ curl --location --request GET 'localhost:8080/createJWT' \ ### CREATE PRODUCT (Admin only) ``` -curl -H "Content-Type: application/json" -d '{"description":"test","totalrating":4.0,"price":2.38}' localhost:8080/product/new +curl --location 'localhost:8080/products' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer INSERT_TOKEN_HERE' \ +--data '{ + "name": "WirePods", + "description": "Kabellose Kopfhörer", + "price": 130.20 +}' +``` + +### UPDATE PRODUCT (Admin only) +``` +curl --location --request PUT 'localhost:8080/products/1' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Bearer INSERT_TOKEN_HERE' \ +--data '{ + "name": "new Name", + "description": "new Description", + "price": 100.00 +}' +``` + +### DELETE PRODUCT (Admin only) +``` +curl --location --request DELETE 'localhost:8080/products/1' \ +--header 'Authorization: Bearer INSERT_TOKEN_HERE' +``` + +### GET ALL PRODUCTS +``` +curl --location 'localhost:8080/products' ``` +### GET SINGLE PRODUCT +``` +curl --location 'localhost:8080/products/1' +``` -Read Product -curl localhost:8080/products \ No newline at end of file +### Health Check +Function tests if the service is running. +``` +curl --location 'localhost:8080/health' +``` \ No newline at end of file