Fake E-commerce API
Base URL
https://fakeapi.net
Common Query Parameters
All list endpoints support the following query parameters:
Parameter | Type | Description | Example |
---|---|---|---|
page | number | Page number for pagination (default: 1) | ?page=2 |
limit | number | Items per page (default: 10, max: 100) | ?limit=20 |
search | string | Search term | ?search=phone |
searchFields | string | Comma-separated fields to search in | ?searchFields=title,brand |
sort | string | Field to sort by | ?sort=price |
order | string | Sort order ('asc' or 'desc') | ?order=desc |
Products
Get All Products
GET /products
Query Parameters:
- All common query parameters
- category: Filter by category
- price: Filter by price range
- brand: Filter by brand
- stock: Filter by stock availability
Example Request:
GET /products?page=1&limit=10&category=electronics&price={"min":100,"max":1000}
Example Response:
{
"data": [
{
"id": 1,
"title": "Smartphone X",
"price": 799.99,
"description": "Latest smartphone with advanced features",
"category": "electronics",
"brand": "TechCo",
"stock": 50,
"image": "https://fakeapi.net/images/smartphone.jpg",
"specs": {
"color": "black",
"weight": "180g",
"storage": "128GB"
},
"rating": {
"rate": 4.5,
"count": 120
}
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 20
}
}
Get Single Product
GET /products/:id
Example Response:
{
"id": 1,
"title": "Smartphone X",
"price": 799.99,
// ... other product fields
}
Get Product Categories
GET /products/categories
Example Response:
[
"electronics",
"clothing",
"footwear",
"appliances"
]
Get Products by Category
GET /products/category/:category
Users
Get All Users
GET /users
Query Parameters:
- All common query parameters
Example Response:
{
"data": [
{
"id": 1,
"email": "[email protected]",
"username": "johndoe",
"name": {
"firstname": "John",
"lastname": "Doe"
},
"address": {
"street": "123 Main St",
"city": "Boston",
"zipcode": "02108",
"country": "USA"
},
"phone": "1-555-555-0123",
"orders": [1, 2]
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 2
}
}
Get Single User
GET /users/:id
Orders
Get All Orders
GET /orders
Query Parameters:
- All common query parameters
- status: Filter by order status
- userId: Filter by user ID
Example Response:
{
"data": [
{
"id": 1,
"userId": 1,
"products": [
{
"productId": 1,
"quantity": 2
}
],
"totalAmount": 1629.97,
"status": "delivered",
"orderDate": "2024-01-15",
"deliveryDate": "2024-01-20"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 3
}
}
Get Single Order
GET /orders/:id
Get User Orders
GET /users/:id/orders
Reviews
Get All Reviews
GET /reviews
Query Parameters:
- All common query parameters
- productId: Filter by product ID
- userId: Filter by user ID
- rating: Filter by rating
Example Response:
{
"data": [
{
"id": 1,
"productId": 1,
"userId": 1,
"rating": 5,
"title": "Great product!",
"content": "Exactly what I was looking for",
"date": "2024-01-25"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 3
}
}
Get Product Reviews
GET /products/:id/reviews
Error Responses
The API uses conventional HTTP response codes:
- 200: Success
- 400: Bad Request
- 404: Not Found
- 405: Method Not Allowed
- 500: Internal Server Error
Error Response Format:
{
"error": "Error Type",
"message": "Detailed error message"
}
Rate Limiting
- Rate limit: 100 requests per minute
- Rate limit headers are included in responses:
- X-RateLimit-Limit
- X-RateLimit-Remaining
- X-RateLimit-Reset
CORS
The API supports Cross-Origin Resource Sharing (CORS) for all origins.
Caching
Responses are cached for 1 hour (3600 seconds).