Mock-API (v2.1.11)
A free Mock API for testing and prototyping e-commerce applications.
🛒 Products
Get all products
Retrieve a list of all available products.
Responses
fetch('https://mockapi.kingtechnology.in/api/products.php')
.then(response => response.json())
.then(data => console.log(data));
Add a new product
Create a new product.
Request body schema
Responses
{
"title": "string",
"price": 0.1,
"description": "string",
"category": "string",
"image": "https://example.com/image.jpg"
}
Get a single product
Retrieve details of a specific product by ID.
Path parameters
Responses
fetch('https://mockapi.kingtechnology.in/api/products.php?id=1')
.then(response => response.json())
.then(data => console.log(data));
Update a product
Update an existing product.
fetch('https://mockapi.kingtechnology.in/api/products.php?id=1', {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"title": "Updated Product",
"price": 29.99,
"description": "Updated description",
"category": "electronics",
"image": "https://example.com/image.jpg"
})
})
.then(response => response.json())
.then(data => console.log(data));
Delete a product
Delete a product by ID.
fetch('https://mockapi.kingtechnology.in/api/products.php?id=1', {
method: 'DELETE'
})
.then(response => response.json())
.then(data => console.log(data));
🛍️ Carts
Get all carts
Retrieve a list of all available carts.
fetch('https://mockapi.kingtechnology.in/api/carts.php')
.then(response => response.json())
.then(data => console.log(data));
Add a new cart
Create a new shopping cart.
{
"userId": 1,
"date": "2026-09-22",
"products": [
{
"productId": 1,
"quantity": 2
}
]
}
Get a single cart
Retrieve details of a specific cart by ID.
fetch('https://mockapi.kingtechnology.in/api/carts.php?id=1')
.then(response => response.json())
.then(data => console.log(data));
Update a cart
Update an existing shopping cart.
{
"userId": 1,
"date": "2026-09-22",
"products": [
{
"productId": 1,
"quantity": 5
}
]
}
Delete a cart
Delete a cart by ID.
fetch('https://mockapi.kingtechnology.in/api/carts.php?id=1', {
method: 'DELETE'
})
.then(response => response.json())
.then(data => console.log(data));
👤 Users
Get all users
Retrieve a list of all users.
fetch('https://mockapi.kingtechnology.in/api/users.php')
.then(response => response.json())
.then(data => console.log(data));
Add a new user
Create a new user.
{
"username": "john",
"email": "john@example.com",
"password": "password123"
}
Get a single user
Retrieve details of a specific user by ID.
fetch('https://mockapi.kingtechnology.in/api/users.php?id=1')
.then(response => response.json())
.then(data => console.log(data));
Update a user
Update an existing user.
{
"username": "updatedUser",
"email": "updated@example.com",
"password": "newPassword"
}
Delete a user
Delete a user by ID.
fetch('https://mockapi.kingtechnology.in/api/users.php?id=1', {
method: 'DELETE'
})
.then(response => response.json())
.then(data => console.log(data));
🔐 Auth
Login
Authenticate a user.
Request body schema
Responses
{
"username": "string",
"password": "string"
}