Skip to content

Instantly share code, notes, and snippets.

@elishaukpong
Last active June 24, 2022 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elishaukpong/877388f77b1e538298c4524882f6df9e to your computer and use it in GitHub Desktop.
Save elishaukpong/877388f77b1e538298c4524882f6df9e to your computer and use it in GitHub Desktop.
REST API Endpoints
To Add a lot
POST base_url/sellers/{seller_id}/lots/create
Request Body
{
weight:float|min_weight:500,
country_of_origin:string or id (if list of country db exiss and is seeded),
harvest_date:date_time,
cultivar: string
}
Response
{
status_message: string,
status_code: int,
data: array
}
Validation Response //applicable on all routes
{
status_message:string,
status_code:int,
errors: ['name':error_message]
}
To Update a lot
PATCH base_url/sellers/{seller_id}/lots/{lot_id}/update
//any field that needs to be updated has to be passed to the request body
Request Body
{
weight:float|min_weight:500,
country_of_origin:string or id (if list of country db exiss and is seeded),
harvest_date:date_time,
cultivar: string
}
Response
{
status_message: string,
status_code: int,
data: array
}
To Delete a lot
DELETE base_url/sellers/{seller_id}/lots/{lot_id}/delete
Request {
}
Response
{
status_message: string,
status_code: int,
}
To bid on a lot
POST base_url/lots/{lot_id}/bids/create
Request {
buyer_id: int,
bid_per_kg: float,
duration_in_days: int
}
Response
{
status_message: string,
status_code: int,
data:array
}
To list bids on a lot
GET base_url/lots/{lot_id}/bids
Request {
page:int
}
Response
{
status_message: string,
status_code: int,
data:array
}
To start auction on lot
POST base_url/lots/{lot_id}/auction/create
Request {
bid_per_kg: float,
duration_in_days: int
}
Response
{
status_message: string,
status_code: int,
data:array
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment