Introduction
This Furniture Store API serves as the back-end for a furniture store application, designed to provide product information to the already existing React-based front-end. It allows users to retrieve details about furniture categories and specific products, supporting filters like product availability, pricing in different currencies, and more. The API only supports GET requests and provides data in JSON format.
API documentation:
Return all product categories URL
/categories.php
Method:
GET
URL Params
There are no URL params
Example:
/categories.php
Success Response:
Code: 200 Content: { "message": "Successfully retrieved categories", "data": [ { "id": "1", "name": "Chair", "products": "82" }, { "id": "2", "name": "Table", "products": "37" } ] } Error Response:
Code: 500 SERVER ERROR Content: {"message": "Unexpected error", "data": []} Return all products in a category URL
/products.php
Method:
GET
URL Params
Required:
cat - category ID for the required products
Optional:
currency - currency unit to provide price in. Choose from: GBP,USD,EUR,YEN. Default is GBP instockonly - boolean choose to only return in-stock products. Default is 0
Example:
/products.php?cat=2¤cy=GBP&instockonly=0
Success Response:
Code: 200 Content: { "message": "Successfully retrieved products", "data": [ { "id": 1, "price": "48.61", "stock": 8, "color": "Teal" }, { "id": 2, "price": "182.08", "stock": 2, "color": "Green" } ] } Error Response:
Code: 400 BAD REQUEST Content: {"message": "Invalid category id", "data": []}
Code: 400 BAD REQUEST Content: {"message": "Invalid currency", "data": []}
Code: 500 SERVER ERROR Content: {"message": "Unexpected error", "data": []}
Return all details about a specific product URL
/product.php
Method:
GET
URL Params
Required:
id - product ID for the requested product
Optional:
unit - unit of measure to provide dimensions in. Choose from: mm,cm,in,ft. Default is mm currency - currency unit to provide price in. Choose from: GBP,USD,EUR,YEN. Defualt is GBP
Example:
/product.php?id=2&unit=mm¤cy=GBP
Success Response:
Code: 200 Content: { "message": "Successfully retrieved product", "data": { "categoryId": 2, "width": 1517, "height": 2040, "depth": 1445, "price": "48.61", "stock": 8, "related": 525, "color": "Teal" } } Error Response:
Code: 400 BAD REQUEST Content: {"message": "Invalid product id", "data": []}
Code: 400 BAD REQUEST Content: {"message": "Invalid currency", "data": []}
Code: 400 BAD REQUEST Content: {"message": "Invalid unit of measure", "data": []}
Code: 500 SERVER ERROR Content: {"message": "Unexpected error", "data": []}