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 list products endpoint returns a paginated collection of all products in the catalogue. You can control which page to fetch and how many results to return per page, and optionally restrict results to active products only. No authentication is required — this endpoint is fully public.

Endpoint

GET /api/v1/products
This endpoint is public. No Authorization header is required.

Query parameters

page
number
default:"1"
The page number to return. Must be a positive integer.
limit
number
default:"10"
The number of products to return per page. Must be a positive integer.
active
boolean
When set to true, only products where isActive is true are returned. Omit this parameter to return all products regardless of active status.

Response

200 OK
message
string
A human-readable confirmation message, e.g. "List of products".
page
number
The current page number as requested.
totalPages
number
The total number of pages available given the current limit.
totalProducts
number
The total count of products matching the applied filter.
products
object[]
Array of product objects.

Error codes

StatusMeaning
500Internal server error — an unexpected error occurred.

Examples

Basic request — first page, default limit:
curl https://api.example.com/api/v1/products
Filter active products only:
curl "https://api.example.com/api/v1/products?active=true"
Custom pagination — page 2 with 5 results per page:
curl "https://api.example.com/api/v1/products?page=2&limit=5"
Example response:
{
  "message": "List of products",
  "page": 1,
  "totalPages": 4,
  "totalProducts": 38,
  "products": [
    {
      "_id": "64f1c2e9a1b2c3d4e5f12345",
      "slug": "matcha-latte",
      "name": "Matcha Latte",
      "category": "Hot drinks",
      "description": "Delicious matcha latte with a hint of sweetness.",
      "basePriceCHF": 5.00,
      "isActive": true,
      "image": "https://res.cloudinary.com/example/image/upload/products/matcha-latte.jpg",
      "size": ["S", "M", "L"],
      "extra_chf": { "S": 0, "M": 2, "L": 3 },
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-03-22T14:05:00.000Z"
    }
  ]
}

Build docs developers (and LLMs) love