Update Order
Update order status and information
Reading time: 1 minute
Update Order
Update order status and information.
PUT
{{base_url}}/orders/{id}Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | Order ID |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
phone_number_id | string | Yes | Phone number ID of the sender |
Request Body (JSON)
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
admin_notes | string | No | Custom admin notes | - |
status | string | No | New order status | - |
payment_status | string | No | Payment status: paid or unpaid | unpaid |
shipping_date | string | No | Shipping date (YYYY-MM-DD) | - |
delivery_date | string | No | Delivery date (YYYY-MM-DD) | - |
branch_id | string | No | Branch ID | - |
Status Update: You can update order status progressively (pending ā accepted ā shipped ā delivered ā completed).
Example Request
Example Requestbash
curl -X PUT "{{base_url}}/orders/1?phone_number_id=123456" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Awal-Signature-256: sha256=abc..." \
-H "X-Timestamp: 1704124800" \
-H "X-Domain: your-workspace" \
-H "X-Client-ID: your-client-id" \
-d '{
"admin_notes": "Shipped via express courier",
"status": "shipped",
"payment_status": "paid",
"shipping_date": "2024-01-20",
"delivery_date": "2024-01-25",
"branch_id": "1"
}'Example Response
Response200 OK
{
"status": true,
"message": "Order updated successfully",
"data": {
"id": 1,
"order_number": "ORD-2024-001",
"status": "shipped",
"payment_status": "paid",
"shipping_date": "2024-01-20",
"delivery_date": "2024-01-25",
"admin_notes": "Shipped via express courier",
"updated_at": "2024-01-20T14:30:00Z"
}
}Use Cases
Track Order from Start to Finish
// 1. Accept order
await updateOrder(orderId, {
status: "accepted",
payment_status: "paid"
});
// 2. Ship order
await updateOrder(orderId, {
status: "shipped",
shipping_date: "2024-01-20"
});
// 3. Deliver order
await updateOrder(orderId, {
status: "delivered",
delivery_date: "2024-01-25"
});
// 4. Complete order
await updateOrder(orderId, {
status: "completed"
});Filter Orders by Status
# Pending orders
GET /orders?status=pending&phone_number_id=123456
# Shipped orders
GET /orders?status=shipped&phone_number_id=123456
# Completed orders
GET /orders?status=completed&phone_number_id=123456Error Codes
| Code | Description | Cause | Solution |
|---|---|---|---|
| 400 | Bad Request | Invalid data | Check sent data |
| 404 | Not Found | Order not found | Check order ID |
| 422 | Validation Error | Validation error | Review error message |
Related
ā Back to Orders
View Guide