API Documentation v2.1.11

Mock-API (v2.1.11)

E-mail: info@kingtechnology.in | URL: https://mockapi.kingtechnology.in

A free Mock API for testing and prototyping e-commerce applications.

🛒 Products

Get all products

Retrieve a list of all available products.

Responses

✓ 200 Success
— 400 Bad request
GET /products
Request sample
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

id
integer
title
string
price
number <float>
description
string
category
string
image
string <uri>

Responses

201 Product created successfully
400 Bad request
POST /products
Content type
application/json
{
    "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

id required
integer

Responses

200 Success
400 Bad request
GET /products/{id}
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.

Required fields
title
string
price
number
description
string
category
string
image
string
PUT /products/{id}
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.

DEL /products/{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.

200 Success
400 Bad request
GET /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.

POST /carts
{
    "userId": 1,
    "date": "2026-09-22",
    "products": [
        {
            "productId": 1,
            "quantity": 2
        }
    ]
}

Get a single cart

Retrieve details of a specific cart by ID.

GET /carts/{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.

PUT /carts/{id}
{
    "userId": 1,
    "date": "2026-09-22",
    "products": [
        {
            "productId": 1,
            "quantity": 5
        }
    ]
}

Delete a cart

Delete a cart by ID.

DEL /carts/{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.

200 Success
400 Bad request
GET /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.

POST /users
{
    "username": "john",
    "email": "john@example.com",
    "password": "password123"
}

Get a single user

Retrieve details of a specific user by ID.

GET /users/{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.

PUT /users/{id}
{
    "username": "updatedUser",
    "email": "updated@example.com",
    "password": "newPassword"
}

Delete a user

Delete a user by ID.

DEL /users/{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

username
string
password
string

Responses

200 Login successful
400 Bad request
POST /auth/login
Content type
application/json
{
    "username": "string",
    "password": "string"
}