Skip to main content

Get All Products

Retrieve all products in the catalog, sorted by most recent first.

Authentication

No authentication required.

Response

Returns an array of product objects.
_id
string
required
Unique product identifier
name
string
required
Product name
description
string
required
Product description
price
number
required
Product price in COP (Colombian Peso)
stock
number
required
Available stock quantity
category
string
required
Product category
images
array
required
Array of image URLs (up to 3 images)
averageRating
number
Average rating from 0 to 5
totalReviews
number
Total number of reviews
createdAt
string
ISO 8601 timestamp of creation
updatedAt
string
ISO 8601 timestamp of last update

Example Request

curl -X GET https://api.donpalitojr.com/api/products

Example Response

[
  {
    "_id": "65f8a1b2c3d4e5f6g7h8i9j0",
    "name": "Empanada de Pollo",
    "description": "Deliciosa empanada rellena de pollo y especias",
    "price": 3500,
    "stock": 50,
    "category": "empanadas",
    "images": [
      "https://res.cloudinary.com/xxx/products/empanada1.jpg"
    ],
    "averageRating": 4.5,
    "totalReviews": 23,
    "createdAt": "2024-03-15T10:30:00.000Z",
    "updatedAt": "2024-03-15T10:30:00.000Z"
  }
]

Get Product by ID

Retrieve detailed information about a specific product.

Authentication

No authentication required.

Path Parameters

id
string
required
The unique identifier of the product

Response

Returns a single product object with all fields described above.

Example Request

curl -X GET https://api.donpalitojr.com/api/products/65f8a1b2c3d4e5f6g7h8i9j0

Example Response

{
  "_id": "65f8a1b2c3d4e5f6g7h8i9j0",
  "name": "Empanada de Pollo",
  "description": "Deliciosa empanada rellena de pollo y especias",
  "price": 3500,
  "stock": 50,
  "category": "empanadas",
  "images": [
    "https://res.cloudinary.com/xxx/products/empanada1.jpg"
  ],
  "averageRating": 4.5,
  "totalReviews": 23,
  "createdAt": "2024-03-15T10:30:00.000Z",
  "updatedAt": "2024-03-15T10:30:00.000Z"
}

Error Responses

404 Not Found
Product with the specified ID does not exist
{
  "message": "Product not found"
}
500 Internal Server Error
Server error occurred while fetching the product
{
  "error": "Internal server error"
}

Build docs developers (and LLMs) love