Here are some example cURL requests to demonstrate how to interact with the API.
curl -X POST http://localhost:8080/login \
-H "Content-Type: application/json" \
-d '{
"username": "amin",
"password": "456"
}'
curl -X POST http://localhost:8080/signup \
-H "Content-Type: application/json" \
-d '{
"address": "Tehran",
"birthDate": "1990-05-15",
"email": "[email protected]",
"username": "Reza",
"password": "secret"
}'
curl -X POST http://localhost:8080/buy-list \
-H "Content-Type: application/json" \
-d '{
"username": "amin"
}'
curl -X POST http://localhost:8080/purchased-list \
-H "Content-Type: application/json" \
-d '{
"username": "amin"
}'
curl -X POST http://localhost:8080/buy-list/add \
-H "Content-Type: application/json" \
-d '{
"username": "amin",
"id": "1"
}'
curl -X POST http://localhost:8080/buy-list/remove \
-H "Content-Type: application/json" \
-d '{
"username": "amin",
"id": "1"
}'
curl -X POST http://localhost:8080/buy-list/purchase \
-H "Content-Type: application/json" \
-d '{
"username": "amin"
}'
curl -X POST http://localhost:8080/comment/123/like \
-H "Content-Type: application/json" \
-d '{
"username": "amin"
}'
curl -X POST http://localhost:8080/comment/123/dislike \
-H "Content-Type: application/json" \
-d '{
"username": "amin"
}'
Replace "123"
with the appropriate comment ID.
curl -X GET http://localhost:8080/commodities
curl -X GET http://localhost:8080/commodities/123
Replace "123"
with the appropriate commodity ID.
curl -X POST http://localhost:8080/commodities/123/rate \
-H "Content-Type: application/json" \
-d '{
"rate": 5,
"username": "amin"
}'
Replace "123"
with the appropriate commodity ID.
curl -X POST http://localhost:8080/commodities/123/comment \
-H "Content-Type: application/json" \
-d '{
"username": "example_user",
"comment": "This is a great product!"
}'
Replace "123"
with the appropriate commodity ID.
curl -X GET http://localhost:8080/commodities/123/comment
Replace "123"
with the appropriate commodity ID.
curl -X POST http://localhost:8080/commodities/search \
-H "Content-Type: application/json" \
-d '{
"searchOption": "name",
"searchValue": "example"
}'
Replace "name"
with the desired search option ("name", "category", or "provider"), and "example"
with the search value.
curl -X GET http://localhost:8080/commodities/123/suggested
Replace "123"
with the appropriate commodity ID.
curl -X GET http://localhost:8080/providers/123
Replace "123"
with the appropriate provider ID.
curl -X GET http://localhost:8080/providers/123/commodities
Replace "123"
with the appropriate provider ID.
curl -X GET http://localhost:8080/users/123
Replace "123"
with the appropriate user ID.
curl -X POST http://localhost:8080/users/123/credit \
-H "Content-Type: application/json" \
-d '{
"credit": 50.0
}'
Replace "123"
with the appropriate user ID, and "50.0"
with the desired credit amount.