Welcome to the Parksons Stock Tracker API. This document provides all the information you need to interact with the API.
Back to Home UIThis API allows you to manage products and track stock movements in a warehouse. It provides endpoints for creating products, recording stock-in/stock-out transactions, and checking current inventory levels.
Base URL: https://kothasaikrishnas-parksons-internship.onrender.com
GET /api/products/
Retrieves a list of all products in the master list.
POST /api/products/
Creates a new product. The GTIN must be unique.
{
"gtin": "8901234567890",
"product_name": "Premium Quality Paper",
"description": "A4 size, 90 GSM paper ream."
}
curl -X POST https://kothasaikrishnas-parksons-internship.onrender.com/api/products/ \
-H "Content-Type: application/json" \
-d '{
"gtin": "8901234567890",
"product_name": "Premium Quality Paper",
"description": "A4 size, 90 GSM paper ream."
}'
{
"id": 1,
"gtin": "8901234567890",
"product_name": "Premium Quality Paper",
"description": "A4 size, 90 GSM paper ream."
}
POST /api/stock/in/
Records an incoming stock transaction for one or more products.
{
"items": [
{
"product_gtin": "8901234567890",
"quantity": 100
}
]
}
{
"message": "Transaction successful",
"transaction_id": 1
}
POST /api/stock/out/
Records an outgoing stock transaction. The API will validate if there is enough stock available.
{
"items": [
{
"product_gtin": "8901234567890",
"quantity": 10
}
]
}
{
"error": "Not enough stock for 'Premium Quality Paper' (GTIN: 8901234567890). Available: 5, Requested: 10"
}
GET /api/stock/level/{gtin}/
Retrieves the current calculated stock level for a single product using its GTIN.
curl https://kothasaikrishnas-parksons-internship.onrender.com/api/stock/level/8901234567890/
{
"product_gtin": "8901234567890",
"product_name": "Premium Quality Paper",
"quantity": 90
}