PUT
5 min read
Update Part
PUT
/api/v1/parts/{id}
Update an existing part in your inventory
Update Part
Update an existing part's information.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id |
integer | The part ID |
Request Body
All fields are optional. Only include fields you want to update.
| Field | Type | Description |
|---|---|---|
name |
string | Part name (max 255 chars) |
part_number |
string | Manufacturer part number (max 100 chars) |
sku |
string | Stock keeping unit (max 100 chars) |
description |
string | Part description |
category |
string | Part category (max 100 chars) |
brand |
string | Brand name (max 100 chars) |
cost_price |
number | Cost price (min 0) |
selling_price |
number | Selling price (min 0) |
quantity_in_stock |
integer | Current stock quantity (min 0) |
reorder_level |
integer | Low stock threshold (min 0) |
unit |
string | Unit of measure (max 20 chars) |
is_active |
boolean | Whether part is active |
Example Request
curl -X PUT "https://hydra.marketdragon.ph/api/v1/parts/45" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"selling_price": 850.00,
"reorder_level": 15
}'
Example Response
{
"data": {
"id": 45,
"company_id": 1,
"name": "Brake Pad Set",
"part_number": "BP-78901",
"sku": "SKU-045",
"description": "Premium ceramic brake pads for sedans",
"category": "Brakes",
"brand": "StopMax",
"cost_price": "450.00",
"selling_price": "850.00",
"quantity_in_stock": 50,
"reorder_level": 15,
"unit": "set",
"is_active": true,
"stock_status": "in_stock",
"is_low_stock": false,
"profit_margin": 88.89,
"thumbnail_url": null,
"image_url": null,
"created_at": "2024-01-20T10:15:00+00:00",
"updated_at": "2024-01-20T14:30:00+00:00"
}
}
Error Responses
403 Forbidden
{
"message": "You do not have access to this part."
}
404 Not Found
{
"message": "No query results for model [Part] 999"
}
Back to Parts
Was this helpful?