-
Notifications
You must be signed in to change notification settings - Fork 0
API
eriudo edited this page Apr 24, 2021
·
20 revisions
GET /products
RESPONSE
[
{
"name": "Apple",
"price": 10.3,
"available": 10
},
{
"name": "Banana",
"price": 5.3,
"available": 3
}
]
POST /products
REQUEST
[
{
"name": "PineApple",
"price": 4.3,
"available": 5
}
]
GET /products/{id}
RESPONSE
{
"name": "Apple",
"price": 10.3,
"available": 10
}
PUT /products/{id}
REQUEST
{
"name": "NewApple",
"price": 10.3,
"available": 5
}
DELETE /products/{id}
Exclui as informações daquele produto, identificado pela sua ID
GET /vouchers
RESPONSE
[
{
"type": "shipping",
"code": "#FRETEGRATIS",
"amount": 0,
"available": true
},
{
"type": "percentual",
"code": "#30OFF",
"amount": 30,
"available": false
},
{
"type": "fixed",
"code": "#10REAIS",
"amount": 10,
"available": true
}
]
GET /vouchers/{id}
RESPONSE
{
"type": "shipping",
"code": "#FRETEGRATIS",
"amount": 0,
"available": true
}
POST /vouchers
REQUEST
{
"type": "shipping",
"code": "#FRETESOHOJEGRATIS",
"amount": 20,
"available": true
}
PUT /vouchers/{id}
REQUEST
{
"type": "shipping",
"code": "#FRETESOHOJEGRATIS",
"amount": 20,
"available": false
}
DELETE /vouchers/{id}
Exclui as informações daquele voucher, identificado pela sua ID
POST users/{id}/orders/{id}/checkout
RESPONSE
{
"subtotal": 234.00,
"shipping": 10.00,
"discount": 1.00,
"total": 243.00
}
POST /users
REQUEST
{
"name": "usuario",
"email": "[email protected]",
"senha": "123456789",
}
GET /users/{id}
RESPONSE
{
"name": "usuario",
"email": "[email protected]"
}
REQUEST
POST /users/{id}/orders
{
"products": [{ "product_id": "BzqfFaz12z1o", "amount": 5 }, {"product_id": "pqRaWaS91z1o", "amount": 9 }],
"voucher_id": "sdSzXaz17z1y",
"date": "21/03/2021"
}
GET /users/{id}/orders
RESPONSE
{
"products": [{ "product_id": "sdfaWaz12z1o", "amount": 5 }, {"product_id": "sdfaWaz12z1o", "amount": 9 }],
"voucher_id": "sdfaSsI85z1o",
"date": "21/03/2021"
}