Dummy Api for Learning and Testing
Get all products
GET /products
Try it →
You can make a request like:
fetch('/products')
.then(res => res.json())
.then(data => console.log(data));
Example response:
[
{
"id": 1,
"image": "https://example.com/images/tshirt1.jpg",
"name": "Classic Cotton T-Shirt",
"rating": 4.5,
"price": 19.99,
"keywords": ["tshirt", "cotton", "casual"],
"userId": 0,
"type": "tshirt",
"sizeChart": "https://example.com/sizecharts/tshirt"
},
{
"id": 2,
"image": "https://example.com/images/hoodie1.jpg",
"name": "Cozy Fleece Hoodie",
"rating": 4.7,
"price": 39.99,
"keywords": ["hoodie", "warm"],
"userId": 1,
"type": "hoodie",
"sizeChart": "https://example.com/sizecharts/hoodie"
}
]
Get product by keyword
GET /products/{keyword}
Try it with "shoes" →
You can make a request like:
fetch('/products/shoes')
.then(res => res.json())
.then(data => console.log(data));
Example response:
[
{
"id": 4,
"image": "https://example.com/images/shoes1.jpg",
"name": "Running Sneakers",
"rating": 4.6,
"price": 59.99,
"keywords": ["shoes", "running", "sport"],
"userId": 0
}
]
Get products of a specific user
GET /products/user/{userId}
Try it with userId 1 →
You can make a request like:
fetch('/products/user/1')
.then(res => res.json())
.then(data => console.log(data));
Example response:
[
{
"id": 2,
"image": "https://example.com/images/hoodie1.jpg",
"name": "Cozy Fleece Hoodie",
"rating": 4.7,
"price": 39.99,
"keywords": ["hoodie", "warm"],
"userId": 1,
"type": "hoodie",
"sizeChart": "https://example.com/sizecharts/hoodie"
},
{
"id": 6,
"image": "https://example.com/images/mug1.jpg",
"name": "Ceramic Coffee Mug",
"rating": 4.2,
"price": 9.99,
"keywords": ["mug", "kitchen", "coffee"],
"userId": 1
}
]
Get all users
GET /users
Try it →
You can make a request like:
fetch('/users')
.then(res => res.json())
.then(data => console.log(data));
Example response:
[
{
"id": 0,
"name": "John Doe",
"occupation": "Product Manager",
"phone": "555-000-1111"
},
{
"id": 1,
"name": "Alice Johnson",
"occupation": "Software Engineer",
"phone": "555-123-4567"
}
]
Get a user by id
GET /users/{id}
Try it with id 1 →
You can make a request like:
fetch('/users/1')
.then(res => res.json())
.then(data => console.log(data));
Example response:
{
"id": 1,
"name": "Alice Johnson",
"occupation": "Software Engineer",
"phone": "555-123-4567"
}