Mock Food Ordering API
  1. Orders
Mock Food Ordering API
  • General
    • API Information
      GET
    • Health Check
      GET
  • Orders
    • List Orders
      GET
    • Create Order
      POST
    • Get Order by ID
      GET
    • Update Order
      PATCH
    • Delete Order
      DELETE
    • Cancel Order (Convenience Endpoint)
      PATCH
  • Schemas
    • Schemas
      • OrderStatus
      • OrderItem
      • Receipt
      • Order
      • CreateOrderRequest
      • UpdateOrderRequest
      • Pagination
      • OrderListData
      • ApiResponse
      • OrderResponse
      • OrderListResponse
      • DeleteResponse
      • HealthResponse
      • ApiInfoResponse
      • ErrorResponse
    • Response
      • BadRequest
      • NotFound
      • ValidationError
      • InternalServerError
  1. Orders

Update Order

PATCH
/orders/{id}
Update an existing order's status or items.
Status transitions must follow business rules (e.g., cannot cancel a completed order).
Items can only be updated for pending orders.

Request

Path Params

Body Params application/json

Examples

Responses

🟢200OK
application/json
Order updated successfully
Body

🟠400Bad Request
🟠404Record Not Found
🟠422Parameter Error
🔴500Server Error
Request Request Example
Shell
JavaScript
Java
Swift
cURL
curl --location --request PATCH '/orders/ORD-1705312200000-001' \
--header 'Content-Type: application/json' \
--data-raw '{
    "status": "paid"
}'
Response Response Example
200 - Example 1
{
    "success": true,
    "data": {
        "id": "ORD-1705312200000-001",
        "customerName": "John Doe",
        "customerEmail": "john@example.com",
        "status": "pending",
        "items": [
            {
                "id": "item-1",
                "orderId": "ORD-1705312200000-001",
                "name": "Burger",
                "quantity": 1,
                "price": 8.99,
                "subtotal": 8.99
            }
        ],
        "total": 12.98,
        "receipt": {
            "id": "receipt-1",
            "orderId": "ORD-1705312200000-001",
            "receiptNumber": "RCP-1705312260000-001",
            "issuedAt": "2024-01-15T10:31:00.000Z",
            "totalAmount": 12.98
        },
        "createdAt": "2024-01-15T10:30:00.000Z",
        "updatedAt": "2024-01-15T10:30:00.000Z"
    },
    "error": {
        "code": "VALIDATION_ERROR",
        "message": "Customer name is required",
        "details": null
    },
    "meta": {
        "total": 0,
        "page": 0,
        "limit": 0,
        "offset": 0
    }
}
Modified at 2025-09-17 13:22:25
Previous
Get Order by ID
Next
Delete Order
Built with