Skip to content
Snippets Groups Projects
Commit e10fb4b9 authored by albrecht's avatar albrecht
Browse files

Productfunktionen in readme eingefügt

parent e2e62e86
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,8 @@ docker compose down ...@@ -20,6 +20,8 @@ docker compose down
## All API Functions ## All API Functions
In this section all API-Functions will be presented with an example call! In this section all API-Functions will be presented with an example call!
### GET JWT-Token ### GET JWT-Token
Use the Result-Token for all marked API-Functions! Use the Result-Token for all marked API-Functions!
``` ```
...@@ -33,9 +35,46 @@ curl --location --request GET 'localhost:8080/createJWT' \ ...@@ -33,9 +35,46 @@ curl --location --request GET 'localhost:8080/createJWT' \
### CREATE PRODUCT (Admin only) ### 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 ### Health Check
curl localhost:8080/products Function tests if the service is running.
\ No newline at end of file ```
curl --location 'localhost:8080/health'
```
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment