The MockX Cart API provides a robust solution for e-commerce platforms, enabling developers to interact with shopping cart data. This API facilitates a range of actions, including retrieving cart information, creating new carts, updating existing carts, and deleting carts.
Endpoints Overview
The MockX Cart API includes several endpoints to address different shopping cart management needs:
GET /: Fetches all shopping carts.
GET /user/:userId: Retrieves carts associated with a specific user.
GET /:id: Fetches a specific cart by its unique ID.
POST /add: Creates a new shopping cart.
PUT /:id: Updates an entire shopping cart by ID.
PATCH /:id: Partially updates a shopping cart by ID.
DELETE /:id: Deletes a shopping cart by ID.
Get All Carts
Retrieve a list of all shopping carts in the system.
Parameters:
limit: Limits the number of carts returned.
skip: Skips a specified number of carts.
Example Response:
Get Carts by User ID
Fetch carts associated with a specific user.
Parameters:
userId: The unique identifier of the user.
limit and skip: Same as above.
Example Response:
Get Cart by ID
Retrieve detailed information about a specific cart.
Parameters:
id: The unique identifier of the cart.
Example Response:
Add New Cart
Create a new cart with specified products.
Body:
Include details such as user ID and products in the request body.
Example Response:
Update Cart by ID
Modify the details of an existing cart.
Example :
Request Body :
Parameters:
id: The unique identifier of the cart to be updated.
Body:
Include the updated cart details in the request body.
Example Response:
Delete Cart by ID
Remove a cart from the database.
Parameters:
id: The unique identifier of the cart 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.