Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/floriansalvi/HEIG-VD_Ocha-api/llms.txt

Use this file to discover all available pages before exploring further.

The Get Order Items endpoint retrieves every OrderItem document associated with the specified order. Each item captures a snapshot of the product at the time the order was placed — including product_name, base_price_chf, any size-based extra_chf, and the computed final_price_chf. The product_id field is populated with the full product document.
This endpoint requires a valid user JWT passed in the Authorization header.

HTTP method and path

GET /api/v1/orders/:id/items

Request parameters

Headers

Authorization
string
required
Bearer token for the authenticated user. Format: Bearer <token>.

Path

id
string
required
MongoDB ObjectId of the order whose items you want to retrieve.

Response fields

200 OK

message
string
Human-readable confirmation. Value: "List of items in the order".
items
object[]
Array of order item documents. Empty array if the order has no items.

Error codes

StatusMeaning
400The provided id is not a valid MongoDB ObjectId.
401Missing or invalid JWT token.
404No order exists with the given id.
500Unexpected server error.

Example

curl --request GET \
  --url https://api.example.com/api/v1/orders/64f1c2e9a1b2c3d4e5f99999/items \
  --header 'Authorization: Bearer <user_token>'
{
  "message": "List of items in the order",
  "items": [
    {
      "_id": "64f1c2e9a1b2c3d4e5faaa01",
      "order_id": "64f1c2e9a1b2c3d4e5f99999",
      "product_id": {
        "_id": "64f1c2e9a1b2c3d4e5f12346",
        "name": "Matcha Latte"
      },
      "product_name": "Matcha Latte",
      "size": "M",
      "quantity": 2,
      "base_price_chf": 5.50,
      "extra_chf": 0.40,
      "final_price_chf": 5.90,
      "createdAt": "2026-01-09T08:00:00.000Z",
      "updatedAt": "2026-01-09T08:00:00.000Z"
    }
  ]
}

Build docs developers (and LLMs) love