The MockX Products API allows developers to access and manipulate a wide array of product data, ranging from electronic devices to household items. This API facilitates operations such as fetching all products, searching for specific products, managing product categories, and modifying product details.
Endpoints Overview
The MockX Products API offers a variety of endpoints to suit different requirements for accessing and managing product information:
GET /: Retrieve all products in the database.
GET /search: Search for products based on query parameters.
GET /categories: Obtain a list of all product categories.
GET /:id: Fetch a specific product by its unique ID.
GET /category/:categoryName: Retrieve products by category name.
POST /add: Add a new product to the database.
PUT /:id: Update an entire product entry by ID.
PATCH /:id: Partially update a product entry by ID.
DELETE /:id: Remove a product entry by ID.
Get All Products
Fetch a comprehensive list of all products available.
Parameters:
limit: Limit the number of products returned.
skip: Skip a specified number of products.
select: Specify fields to include in the returned products.
Example Response:
Search Products
Search for products using specific query parameters.
Example :
Request body :
Parameters:
q: Search query (e.g., "solar charger").
limit, skip, select: Similar to the "Get All Products" endpoint.
Example Response:
Get Product Categories
Retrieve a list of all unique product categories.
Example Response:
Get Product by ID
Fetch detailed information about a specific product by its unique ID.
Parameters:
id: The unique identifier of the product.
select: Specify fields to include in the returned product.
Example Response:
Get Products by Category Name
Retrieve products belonging to a specific category.
Parameters:
categoryName: The name of the product category.
limit, skip, select: Same as above.
Example Response:
Add New Product
Add a new product to the database.
Body:
Include all product details in the request body.
Example Response:
Update Product by ID
Update the details of an existing product by its ID.
Parameters:
id: The unique identifier of the product to be updated.
Body: Include the updated product details in the request body.
Example Response:
Delete Product by ID
Remove a product from the database by its ID.
Parameters:
id: The unique identifier of the product to be deleted.
Example Response:
MockX offers free, reliable mock APIs for easy testing and development, ideal for developers seeking to enhance their workflow without the complexities of setting up any server.