API Endpoints#
All endpoints are under the base URL: /api/webapis/
Authentication is by way of JWT Bearer tokens — include Authorization: Bearer <token> in every request (except login and health check).
Authentication#
Method |
Endpoint |
What it does |
|---|---|---|
POST |
|
Exchange username + password for JWT tokens |
Request:
{
"username": "john",
"password": "your-password" // pragma: allowlist secret
}
Response:
{
"status": 200,
"data": {
"access": "eyJ...",
"refresh": "eyJ...",
"user": {
"sqid": "Dk3mV9",
"username": "john",
"roles": ["procurement_team", "member"]
}
}
}
Response Format#
Every API response follows this structure:
{
"status": 200,
"is_success": true,
"message": "Success",
"data": { ... }
}
Errors look like:
{
"status": 400,
"is_success": false,
"message": "Part with this code already exists.",
"data": null
}
Parts#
Parts, Products, and Commodities all use the same endpoints — they’re filtered by type.
Method |
Endpoint |
What it does |
|---|---|---|
GET |
|
List all parts (paginated, searchable) |
POST |
|
Create a new part (may require approval) |
GET |
|
Get a single part’s details |
PUT |
|
Update a part (may require approval) |
GET |
|
List all suppliers for this part |
GET |
|
Audit trail of changes |
GET |
|
Simple id/name list for dropdowns |
Listing parts — supports query params:
?search=screw— Search by code or name?category=Plastic— Filter by category?type=part— Filter by type?offset=0&limit=20— Pagination
Same pattern for Products (/product/...) and Commodities (/commodity/...) — they just filter by type.
Part-Supplier Pricing#
Method |
Endpoint |
What it does |
|---|---|---|
GET |
|
Get all prices/weights for a part-supplier |
POST |
|
Record a new price |
Recording a new price:
{
"head": 1,
"value": 150.5,
"unit": "Rs",
"formula": "value"
}
When you record a new price, the old one’s is_current_price automatically flips to false — so you always have a full history.
Suppliers#
Method |
Endpoint |
What it does |
|---|---|---|
GET |
|
List all suppliers |
POST |
|
Create a new supplier |
GET |
|
Get supplier details |
PUT |
|
Update supplier info |
POST |
|
Link a part to this supplier |
GET |
|
List parts this supplier sells |
GET |
|
List portal users |
POST |
|
Create a portal login |
GET |
|
Simple list for dropdowns |
Master Data#
Categories#
Method |
Endpoint |
What it does |
|---|---|---|
GET |
|
List all categories |
POST |
|
Create a category |
PUT |
|
Update a category |
GET |
|
Simple list |
Value Heads#
Method |
Endpoint |
What it does |
|---|---|---|
GET |
|
List all value types |
POST |
|
Create a value type |
PUT |
|
Update a value type |
GET |
|
Simple list |
Purchase Orders#
Method |
Endpoint |
What it does |
|---|---|---|
GET |
|
List all POs |
POST |
|
Create a draft PO |
GET |
|
Get PO with line items |
PUT |
|
Edit a draft PO |
POST |
|
Submit for approval |
POST |
|
Mark as closed |
POST |
|
Supplier makes counter-offer |
POST |
|
Accept counter-offer |
POST |
|
Reject counter-offer |
GET |
|
Audit trail |
PO lifecycle:
draft → pending_approval → approved → accepted → closed
↘ counter_pending → accepted/rejected
View Templates#
Method |
Endpoint |
What it does |
|---|---|---|
GET |
|
Get display template with ordered values |
Returns an ordered list of values with their sequence, styles, and computed values — ready for the frontend to render.
Approvals#
Method |
Endpoint |
What it does |
|---|---|---|
GET |
|
List approval rules |
POST |
|
Create an approval rule |
PUT |
|
Update a rule |
GET |
|
List change requests |
GET |
|
Get request details |
GET |
|
Get YOUR pending approval tasks |
POST |
|
Approve or reject |
GET |
|
What entity types support approvals |
Approving a task:
{
"action": "approved",
"comment": "Looks good, approved."
}
Users#
Method |
Endpoint |
What it does |
|---|---|---|
GET |
|
List all users (admin only) |
POST |
|
Create a new user |
GET |
|
Get user profile |
PUT |
|
Assign roles/groups |
GET |
|
List available roles |
GET |
|
Simple user list |
Utilities#
Method |
Endpoint |
What it does |
|---|---|---|
GET |
|
Health check (no auth needed) |
GET |
|
Get ContentType ID for a model |
POST |
|
Price simulation for commodities |
Pagination#
List endpoints support:
?offset=0— Skip this many records?limit=20— Return this many records?search=query— Full-text search
Response includes total count for building pagination UI.
Error Codes#
Status |
Meaning |
|---|---|
200 |
Success |
400 |
Validation error (check |
401 |
Not logged in or token expired |
403 |
You don’t have permission |
404 |
Record not found |
429 |
Too many requests (rate limited) |