API Document
Get All Orders
URL: http://api.petdreamhouse.co.uk/api/orders
Method: GET
Auth: Basic Auth
Parameters: None
Example Request
GET /api/orders HTTP/1.1
Host: api.petdreamhouse.co.uk
Authorization: Basic
Example Response
[
{
"order_id": 263,
"invoice_no": 0,
"firstname": "John",
"lastname": "Doe",
"email": "john.doe@example.com",
"telephone": "01234 567890",
"date_added": "2023-06-06 08:50:50",
"total": "219.8240",
"currency_code": "GBP"
},
...
]
Get Order Products
URL: http://api.petdreamhouse.co.uk/api/orders/{order_id}/products
Method: GET
Auth: Basic Auth
Parameters:
- order_id (required) - The ID of the order you want to retrieve products for.
Example Request
GET /api/orders/263/products HTTP/1.1
Host: api.petdreamhouse.co.uk
Authorization: Basic
Example Response
[
{
"product_id": 123,
"name": "Sample Product",
"quantity": 2,
"price": "19.99",
"total": "39.98"
},
...
]
Get Product
URL: http://api.petdreamhouse.co.uk/api/products/{product_id}
Method: GET
Auth: Basic Auth
Parameters:
- product_id (required) - The ID of the product you want to retrieve.
Example Request
GET /api/products/123 HTTP/1.1
Host: api.petdreamhouse.co.uk
Authorization: Basic
Example Response
{
"product_id": 123,
"name": "Sample Product",
"description": "This is a sample product description",
"price": "19.99",
"quantity": 100
}
Get Invoice
URL: http://api.petdreamhouse.co.uk/api/invoices/{invoice_id}
Method: GET
Auth: Basic Auth
Parameters:
- invoice_id (required) - The ID of the invoice you want to retrieve.
Example Request
GET /api/invoices/456 HTTP/1.1
Host: api.petdreamhouse.co.uk
Authorization: Basic
Example Response
{
"invoice_id": 456,
"order_id": 263,
"total": "219.8240",
"date_added": "2023-06-06 08:50:50"
}
Update Order
URL: http://api.petdreamhouse.co.uk/api/orders/{order_id}
Method: PUT
Auth: Basic Auth
Parameters:
- order_id (required) - The ID of the order you want to update.
Body: JSON object containing the fields to update.
Example Request
PUT /api/orders/263 HTTP/1.1
Host: api.petdreamhouse.co.uk
Authorization: Basic
Content-Type: application/json
{
"firstname": "John",
"lastname": "Doe",
"email": "john.doe@example.com",
"telephone": "01234 567890"
}
Example Response
{
"success": true,
"message": "Order updated successfully"
}
Authentication
This API uses Basic Authentication. You need to include your Username and Password encoded in base64 in the Authorization header of your HTTP request.
Example Authorization Header
Authorization: Basic