The product resource has the following schema:
Field | Type | Description |
---|---|---|
price | float | The price of the product |
description | string | the product description |
name | string | The product name |
imported | bool | True if te product is imported, false otherwise |
category | string | product category one of (food, medicine, book, miscellaneous) |
id | uuid v4 string | the product id (is autogenerated at creation time) |
HTTP verb: POST
HTTP successful return code: 201, 400, 500
Endpoint: http://localhost:5000/products
Curl example:
curl -X POST http://localhost:5000/products -d '
{
"name": "Bag of potato chips",
"description": "",
"imported": false,
"category": "food",
"price": 2.50
}'
Returns a product with an ID. Example:
{
"price": 2.5,
"description": "",
"imported": false,
"name": "Bag of potato chips",
"id": "f3753db3-0521-4214-b311-d31bae67921d",
"category": "food"
}
HTTP verb: GET
HTTP potentialc return codes: 200, 400, 500
Endpoint: http://localhost:5000/products
Curl example:
curl http://localhost:5000/products
Returns an empty list if no products are available or a list of products with their IDs
HTTP verb: GET
HTTP successful return code: 200, 400, 404, 500
Endpoint: http://localhost:5000/products/<product_id>
Curl example:
curl http://localhost:5000/products/f3753db3-0521-4214-b311-d31bae67921d
Returns the product if found else returns a 404 status code