Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/lffiesco-svg/gastromovil/llms.txt

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

The Products API exposes four endpoints that give a restaurant owner full control over their menu items. All endpoints are protected — the server verifies that the product belongs to a category that belongs to the authenticated user’s restaurant (categoria__restaurante__propietario=request.user). Product images are stored on Cloudinary and are returned as absolute URLs. Use multipart/form-data when uploading images; use application/json for all other requests.
All four endpoints require authentication. Send a Bearer token in the Authorization header or maintain an active Django session. An unauthenticated request returns 401 Unauthorized.

List Products

Returns all menu products belonging to the authenticated restaurant, across all categories. GET /api/productos/

Example Request

curl -s https://gastromovil.online/api/productos/ \
  -H "Authorization: Bearer <access_token>"

Response

200 OK — array of product objects.
id
integer
Unique database identifier of the product.
nombre
string
Display name of the product.
precio
string
Unit price as a decimal string (e.g. "12500.00").
descripcion
string
Free-text description of the product.
disponible
boolean
Whether the product is currently available for ordering.
imagen
string | null
Absolute URL of the Cloudinary-hosted product image, or null if no image has been uploaded.
categoria_nombre
string
Human-readable name of the category this product belongs to.
categoria_id
integer
Foreign key of the category.
categoria_restaurante_id
integer
Foreign key of the restaurant that owns the category.
[
  {
    "id": 14,
    "nombre": "Burger Clásica",
    "precio": "18500.00",
    "descripcion": "Carne de res 200g, lechuga, tomate y salsa especial.",
    "disponible": true,
    "imagen": "https://res.cloudinary.com/demo/image/upload/v1/burger_clasica.png",
    "categoria_nombre": "Burgers",
    "categoria_id": 2,
    "categoria_restaurante_id": 3
  }
]

Create a Product

Creates a new product and associates it with one of the authenticated restaurant’s categories. Send the request as multipart/form-data when including an image file. POST /api/productos/crear/

Request Body

nombre
string
required
Display name of the product (max 200 characters).
precio
number
required
Unit price as a decimal number (e.g. 18500.00). Must be a valid decimal value.
descripcion
string
Optional free-text description of the product.
disponible
boolean
Whether the product is available for ordering. Defaults to true. Accepted string values: "true", "True", or the boolean true.
imagen
file
Optional product image. Submit as a file field in a multipart/form-data request. Uploaded to Cloudinary automatically.
categoria
integer
Primary key of the category this product belongs to. Must be a category owned by the authenticated restaurant. Omit to create a product with no category.

Example Request (JSON, no image)

curl -s -X POST https://gastromovil.online/api/productos/crear/ \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Burger Clásica",
    "precio": 18500.00,
    "descripcion": "Carne de res 200g, lechuga, tomate y salsa especial.",
    "disponible": true,
    "categoria": 2
  }'

Example Request (multipart, with image)

curl -s -X POST https://gastromovil.online/api/productos/crear/ \
  -H "Authorization: Bearer <access_token>" \
  -F "nombre=Burger Clásica" \
  -F "precio=18500.00" \
  -F "descripcion=Carne de res 200g, lechuga, tomate y salsa especial." \
  -F "disponible=true" \
  -F "categoria=2" \
  -F "imagen=@/path/to/burger.png"

Responses

201 Created — product created successfully.
{
  "mensaje": "Producto creado",
  "id": 14
}
400 Bad Request — missing required fields or invalid price format.
{
  "error": "Nombre y precio son obligatorios"
}

Update a Product

Performs a partial update on an existing product. Only the fields included in the request body are changed. PUT /api/productos/<pk>/editar/

Path Parameters

pk
integer
required
Primary key of the product to update. Must belong to a category of the authenticated user’s restaurant.

Request Body

All fields are optional — include only those you want to change.
nombre
string
New display name (max 200 characters).
precio
number
New unit price as a decimal value.
descripcion
string
New description text.
disponible
boolean
Pass false to hide the product from menus without deleting it.
imagen
file
Replacement image file. Submit as multipart/form-data. Existing Cloudinary asset is replaced.
categoria
integer
Primary key of the new category. Must belong to the authenticated user’s restaurant.

Example Request

curl -s -X PUT https://gastromovil.online/api/productos/14/editar/ \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "precio": 19500.00,
    "disponible": true
  }'

Responses

200 OK
{
  "mensaje": "Producto actualizado"
}
404 Not Found — product does not exist or belongs to another restaurant.
{
  "detail": "No Producto matches the given query."
}

Delete a Product

Permanently removes a product. This action cannot be undone. DELETE /api/productos/<pk>/eliminar/

Path Parameters

pk
integer
required
Primary key of the product to delete. Must belong to a category of the authenticated user’s restaurant.

Example Request

curl -s -X DELETE https://gastromovil.online/api/productos/14/eliminar/ \
  -H "Authorization: Bearer <access_token>"

Responses

200 OK — product deleted.
{
  "mensaje": "Eliminado"
}
404 Not Found — product not found or owned by a different user.
{
  "detail": "No Producto matches the given query."
}
Deleting a product is permanent. Any DetallePedido rows that reference the product may be affected depending on database cascade settings. Prefer setting disponible=false to hide a product from menus rather than deleting it.

Build docs developers (and LLMs) love