This page provides the details of the Order API, which allows you to manage orders on our platform.

Endpoints

  • Get All Orders

    • Path: /api/orders
    • Method: GET
    • Description: Retrieve a list of all orders.
  • Create a New Order

    • Path: /api/orders
    • Method: POST
    • Description: Create a new order with the provided details.
  • Update an Existing Order

    • Path: /api/orders/{order_id}
    • Method: PUT
    • Description: Update the details of an existing order.
  • Delete an Order

    • Path: /api/orders/{order_id}
    • Method: DELETE
    • Description: Delete an order by its ID.

Request and Response Examples

Get All Orders

Request:

GET /api/orders

Response:

[
  {
    "id": 1,
    "customer_id": 123,
    "order_date": "2023-01-01",
    "status": "shipped",
    "total_amount": 100.00
  },
  {
    "id": 2,
    "customer_id": 456,
    "order_date": "2023-01-02",
    "status": "pending",
    "total_amount": 150.00
  }
]

Create a New Order

Request:

POST /api/orders
Content-Type: application/json

{
  "customer_id": 789,
  "order_date": "2023-01-03",
  "items": [
    {
      "item_id": 101,
      "quantity": 2
    },
    {
      "item_id": 102,
      "quantity": 1
    }
  ]
}

Response:

{
  "id": 3,
  "customer_id": 789,
  "order_date": "2023-01-03",
  "status": "pending",
  "total_amount": 200.00
}

For more information, please visit our API Documentation.

Useful Resources

Order Processing