Skip to content

ShayanMirzaei/UT-Software-Testing-Fall-02

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample API Requests

Here are some example cURL requests to demonstrate how to interact with the API.

Authentication

Login

curl -X POST http://localhost:8080/login \
  -H "Content-Type: application/json" \
  -d '{
    "username": "amin",
    "password": "456"
  }'

Signup

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"
  }'

Buy List

Get Buy List

curl -X POST http://localhost:8080/buy-list \
  -H "Content-Type: application/json" \
  -d '{
    "username": "amin"
  }'

Get Purchased List

curl -X POST http://localhost:8080/purchased-list \
  -H "Content-Type: application/json" \
  -d '{
    "username": "amin"
  }'

Add to Buy List

curl -X POST http://localhost:8080/buy-list/add \
  -H "Content-Type: application/json" \
  -d '{
    "username": "amin",
    "id": "1"
  }'

Remove from Buy List

curl -X POST http://localhost:8080/buy-list/remove \
  -H "Content-Type: application/json" \
  -d '{
    "username": "amin",
    "id": "1"
  }'

Purchase Buy List

curl -X POST http://localhost:8080/buy-list/purchase \
  -H "Content-Type: application/json" \
  -d '{
    "username": "amin"
  }'

Comment

Like a Comment

curl -X POST http://localhost:8080/comment/123/like \
  -H "Content-Type: application/json" \
  -d '{
    "username": "amin"
  }'

Dislike a Comment

curl -X POST http://localhost:8080/comment/123/dislike \
  -H "Content-Type: application/json" \
  -d '{
    "username": "amin"
  }'

Replace "123" with the appropriate comment ID.

Commodity

Get All Commodities

curl -X GET http://localhost:8080/commodities

Get a Specific Commodity

curl -X GET http://localhost:8080/commodities/123

Replace "123" with the appropriate commodity ID.

Rate a Commodity

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.

Add a Comment to a Commodity

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.

Get Comments for a Commodity

curl -X GET http://localhost:8080/commodities/123/comment

Replace "123" with the appropriate commodity ID.

Search Commodities

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.

Get Suggested Commodities for a Commodity

curl -X GET http://localhost:8080/commodities/123/suggested

Replace "123" with the appropriate commodity ID.

Provider

Get a Specific Provider

curl -X GET http://localhost:8080/providers/123

Replace "123" with the appropriate provider ID.

Get Commodities Provided by a Provider

curl -X GET http://localhost:8080/providers/123/commodities

Replace "123" with the appropriate provider ID.

User

Get a Specific User

curl -X GET http://localhost:8080/users/123

Replace "123" with the appropriate user ID.

Add Credit to a User

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages