Purchase Order
Endpoint: PUT /api/v6.1/purchase_order
Description: This API is used to update an existing purchase order in the system. The order to be updated is identified by the current_order_code
field.
Request
Method: PUT
Headers:
Content-Type: application/json
X-API-KEY: <your-api-key>
Body (JSON):
{
"current_order_code": "DHM001",
"order_code": "DHM001",
"order_date": "2025-04-25",
"contract_code": "HD0003",
"campaign_code": "CD0024",
"account": {
"account_code": "KH001",
"account_phone": "0123456789",
"account_email": "[email protected]",
"account_address": "Hanoi",
"account_name": "Customer A",
"contact_name": "Contact Person"
},
"discount": 5,
"discount_amount": 4042.5,
"vat": 5,
"vat_amount": 3840.375,
"transport": 5,
"transport_amount": 4042.5,
"installation": 10,
"installation_amount": 8085,
"order_source_name": "FB Source",
"store_name": "Branch A",
"payment_method_name": "Cash",
"assigned_username": "responsible_person",
"order_terms": [
{ "term_content": "Delivery within 2 days" },
{ "term_content": "At Hanoi address" }
],
"custom_fields": {
"sub_order_code": "1234",
"warehouse_storage": "Warehouse A",
"tags": ["Fast Delivery"]
},
"saved_order_details": [
{
"product_code": "SP001",
"product_name": "Product A",
"quantity": 2,
"price": 20000,
"amount": 40000,
"unit_name": "Piece"
},
{
"product_code": "SP003",
"product_name": "Product C",
"quantity": 1,
"price": 35000,
"amount": 34650,
"unit_name": "Pack"
}
]
}
Response
Status: 200 OK
{
"message": "Successfully updated",
"data": {
"order_id": 367,
"order_code": "DHM001"
}
}
Notes
current_order_code
is the current order code to update.- If the order code needs to be changed, use the new
order_code
in the payload. saved_order_details
contains the list of new products, updating all of them.