Skip to main content
GET
/
api
/
Productos
/
{idProducto}
Get Product by ID
curl --request GET \
  --url https://api.example.com/api/Productos/{idProducto}
{
  "idProducto": 123,
  "nombre": "<string>",
  "precio": 123,
  "img": "<string>",
  "stockActual": 123,
  "stockMinimo": 123,
  "idCategoria": 123,
  "descripcion": "<string>",
  "Categoria": {
    "idCategoria": 123,
    "nombre": "<string>",
    "descripcion": "<string>"
  }
}

Authentication

This endpoint may require authentication depending on your API configuration. Include the JWT token in the Authorization header if required.
Authorization: Bearer {token}

Path Parameters

idProducto
integer
required
The unique identifier of the product to retrieve

Response

Returns a single product object.
idProducto
integer
Unique identifier for the product
nombre
string
Product name (max 100 characters)
precio
decimal
Product price (decimal with 2 precision)
img
string
URL or path to the product image
stockActual
integer
Current stock quantity available
stockMinimo
integer
Minimum stock threshold before reorder
idCategoria
integer
Foreign key reference to the product category
descripcion
string
Product description
Categoria
object
Related category object with details
idCategoria
integer
Category ID
nombre
string
Category name (max 100 characters)
descripcion
string
Category description (max 255 characters)

Success Response (200 OK)

{
  "idProducto": 1,
  "nombre": "Alimento para Perros Premium",
  "precio": 45.99,
  "img": "/images/productos/alimento-perros.jpg",
  "stockActual": 150,
  "stockMinimo": 20,
  "idCategoria": 1,
  "descripcion": "Alimento balanceado premium para perros adultos",
  "Categoria": {
    "idCategoria": 1,
    "nombre": "Alimentos",
    "descripcion": "Alimentos y snacks para mascotas"
  }
}

Error Response (404 Not Found)

"El producto no existee"

Code Example

curl -X GET https://api.huellitas.com/api/Productos/1 \
  -H "Authorization: Bearer {your_token_here}"
const productId = 1;
const response = await fetch(`https://api.huellitas.com/api/Productos/${productId}`, {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer ' + token
  }
});

if (response.ok) {
  const producto = await response.json();
  console.log(producto);
} else if (response.status === 404) {
  console.log('Producto no encontrado');
}
import requests

product_id = 1
headers = {
    'Authorization': f'Bearer {token}'
}

response = requests.get(f'https://api.huellitas.com/api/Productos/{product_id}', headers=headers)

if response.status_code == 200:
    producto = response.json()
else:
    print('Producto no encontrado')

Source Reference

Controller: Huellitas.API/Controllers/ProductosController.cs:37 Entity: Huellitas.Core/Entities/Producto.cs

Build docs developers (and LLMs) love