API Documentation for Products

GET /products

Retrieves a list of all products.

Response:

Success
{
    "status": true,
    "message": "Products List",
    "products": [
        {
            "id": 1,
            "name": "Product A"
        },
        {
            "id": 2,
            "name": "Product B"
        }
    ]
}
Error
{
    "status": false,
    "message": "Error message"
}

Sample Request:

curl -i http://api.invidtech.com/api/products?page=1&limit=10&name=Product 1&status=active

Sample Headers:

{
    "Content-Type": "application/json",
    "Authorization": "Bearer your_token"
}

Sample Params:

{
    "page": 1,
    "limit": 10,
    "name": "Product 1",
    "status": "active"
}

POST /products

Creates a new product.

Response:

Success
{
    "status": true,
    "message": "Product created successfully",
    "product": {
        "id": 3,
        "name": "New Product"
    }
}
Error
{
    "status": false,
    "message": "Error message"
}

Sample Request:

curl -X POST -H "Content-Type: application/json" -d '{"name":"New Product"}' http://api.invidtech.com/api/products

Sample Headers:

{
    "Content-Type": "application/json",
    "Authorization": "Bearer your_token"
}

Sample Payload:

{
    "name": "New Product"
}

GET /products/:id

Get product information.

Response:

Success
{
    "status": true,
    "message": "Product retrieved successfully",
    "product": {
        "id": 1,
        "name": "Product A"
    }
}
Error
{
    "status": false,
    "message": "Product not found"
}

Sample Request:

curl -X PUT -H "Content-Type: application/json" -d '{"name":"Updated Product"}' http://api.invidtech.com/api/products/1

Sample Headers:

{
    "Content-Type": "application/json",
    "Authorization": "Bearer your_token"
}

Sample Payload:

{
    "name": "Updated Product"
}

PUT /products/:id

Updates an existing product.

Response:

Success
{
    "status": true,
    "message": "Product updated successfully",
    "product": {
        "id": 1,
        "name": "Updated Product"
    }
}
Error
{
    "status": false,
    "message": "Error message"
}

Sample Request:

curl -X PUT -H "Content-Type: application/json" -d '{"name":"Updated Product"}' http://api.invidtech.com/api/products/1

Sample Headers:

{
    "Content-Type": "application/json",
    "Authorization": "Bearer your_token"
}

Sample Payload:

{
    "name": "Updated Product"
}

DELETE /products/:id

Deletes a product.

Response:

Success
{
    "status": true,
    "message": "Product deleted successfully"
}
Error
{
    "status": false,
    "message": "Error message"
}

Sample Request:

curl -X DELETE http://api.invidtech.com/api/products/1

Sample Headers:

{
    "Content-Type": "application/json",
    "Authorization": "Bearer your_token"
}