Base URL
https://fakeapi.in/api/productsAPI Endpoints
GET
Copy All/api/productsGet all products with pagination & sorting
Parameters
page(number)limit(number)sortField(string)sortOrder(string)GET
Copy All/api/products/10Get product details by ID
Parameters
id(number)GET
Copy All/api/products?q=phoneSearch products by name containing 'phone'
Parameters
q(string)GET
Copy All/api/products?category=BooksFilter products by category 'Books'
Parameters
category(string)GET
Copy All/api/products?sortField=price&sortOrder=descGet products sorted by price descending
Parameters
sortField(string)sortOrder(string)GET
Copy All/api/products?page=2&limit=5Paginate products (page 2, 5 per page)
Parameters
page(number)limit(number)GET
Copy All/api/products?isAvailable=trueFilter products that are available
Parameters
isAvailable(boolean)GET
Copy All/api/products?rating=5Filter products with rating equal to 5
Parameters
rating(number)POST
Copy All/api/productsCreate a new product
Parameters
name(string)price(number)category(string)description(string)isAvailable(boolean)rating(number)image(string)PUT
Copy All/api/products/1Update product (replace all fields)
Parameters
id(number)name(string)price(number)category(string)description(string)isAvailable(boolean)rating(number)image(string)PATCH
Copy All/api/products/1Partially update product (only specified fields will be updated)
Parameters
id(number)fields(object)DELETE
Copy All/api/products/1Delete product
Parameters
id(number)Example Usage
Copy All
import axios from "axios";
const API_URL = process.env.NEXT_PUBLIC_API_URL;
// Get all posts
axios
.get(`${API_URL}api/posts`)
.then(res => console.log("All Posts:", res.data))
.catch(err => console.error(err));
// Create a new post
axios
.post(`${API_URL}api/posts`, {
title: "My First Post",
content: "This is a sample post created by Vishal.",
author: "Vishal"
})
.then(res => console.log("Post Created:", res.data))
.catch(err => console.error(err));
Example Response
Copy All
{
"id": 1,
"name": "Recycled Marble Shoes",
"description": "The sleek and sugary Bike comes with fuchsia LED lighting for smart functionality",
"price": 35147.09,
"category": "Movies",
"stock": 142,
"rating": 4.9,
"image": "https://loremflickr.com/3988/47/product?lock=6914485309837439",
"isAvailable": false,
"createdAt": "2025-04-21T03:20:41.636Z"
}Quick Actions
API Status
StatusOperational
Rate Limit1000 requests/hour
Response FormatJSON
