This document describes the API endpoints used by the CoffeShop application.
Base URL: https://api.coffeshop.com/v1 (Example)
All authenticated endpoints require a Bearer Token in the header.
Authorization: Bearer <your_token>Retrieves a list of available coffee products.
- URL:
/products - Method:
GET - Auth Required: No
Response:
[
{
"id": "1",
"name": "Espresso",
"price": 3.99,
"image": "url_to_image"
},
{
"id": "2",
"name": "Latte",
"price": 4.50,
"image": "url_to_image"
}
]- URL:
/products/:id - Method:
GET
Places a new order.
- URL:
/orders - Method:
POST - Auth Required: Yes
Request Body:
{
"items": [
{ "productId": "1", "quantity": 2 }
],
"total": 7.98
}Response:
{
"id": "order_123",
"status": "pending",
"createdAt": "2024-01-14T10:00:00Z"
}The API uses standard HTTP status codes.
| Code | Description |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 404 | Not Found |
| 500 | Server Error |