From e10fb4b9d24e3ba2f5ef2d527056b25e8c45706d Mon Sep 17 00:00:00 2001 From: albrecht <flo@DESKTOP-ERC0T8S> Date: Mon, 10 Jul 2023 14:26:16 +0200 Subject: [PATCH] =?UTF-8?q?Productfunktionen=20in=20readme=20eingef=C3=BCg?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4f2cb80..d734794 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 -- GitLab