Added readme
This commit is contained in:
75
readme.md
Normal file
75
readme.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# Shopping API
|
||||
|
||||
Creates the Web API for a very basic e-commerce platform. The
|
||||
server is backed by PostgreSQL database.
|
||||
|
||||
## APIs
|
||||
|
||||
### 1. GET /product
|
||||
|
||||
- Returns a JSON response with all the events, ordered by date of creation in ascending order.
|
||||
|
||||
- Output
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"productid": 5,
|
||||
"productname": "Hammer",
|
||||
"created_at": "2020-11-30T21:46:41.359298"
|
||||
},
|
||||
{
|
||||
"productid": 4,
|
||||
"productname": "Soap",
|
||||
"created_at": "2020-11-30T21:46:41.359298"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### 2. POST /orders
|
||||
|
||||
- Accepts a JSON request for an order that comprises one or more tickets.
|
||||
|
||||
- Input
|
||||
|
||||
```json
|
||||
{
|
||||
"email": "mail@id.com",
|
||||
"line_items": [
|
||||
{
|
||||
"productid": 4,
|
||||
"quantity": 10
|
||||
},
|
||||
{
|
||||
"productid": 5,
|
||||
"quantity": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 3. GET /orders (TODO)
|
||||
|
||||
- Returns a JSON response with all the orders, ordered by date of creation.
|
||||
|
||||
- Output
|
||||
|
||||
```json
|
||||
{
|
||||
“orders”: [
|
||||
{
|
||||
“id”: 1,
|
||||
“email”: “test@example.com”,
|
||||
“line_items”: [
|
||||
{
|
||||
“quantity”: 5,
|
||||
“product”: {
|
||||
“id”: 1,
|
||||
“name”: “Product1”
|
||||
}
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user