Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/DevOpsDuoc/Evaluacion02_Devop_Innovatech/llms.txt

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

The Ventas API exposes five endpoints for managing sales records. All endpoints are served under the base path /api/v1/ventas. See the overview page for base URLs, the data model, and error handling.

POST /api/v1/ventas

Creates a new sale record. Returns 201 Created with the created object and a Location header pointing to the new resource.

Body parameters

direccionCompra
string
required
Purchase and delivery address. Cannot be blank.
valorCompra
int
Purchase value (amount).
fechaCompra
string
required
Purchase date in ISO-8601 format (YYYY-MM-DD). Cannot be null.
despachoGenerado
boolean
default:"false"
required
Whether a dispatch record has been generated. Defaults to false.

Example

curl --request POST \
  --url http://localhost:3001/api/v1/ventas \
  --header 'Content-Type: application/json' \
  --data '{
    "direccionCompra": "Av. Providencia 1234, Santiago",
    "valorCompra": 45000,
    "fechaCompra": "2024-03-15",
    "despachoGenerado": false
  }'
Request body
{
  "direccionCompra": "Av. Providencia 1234, Santiago",
  "valorCompra": 45000,
  "fechaCompra": "2024-03-15",
  "despachoGenerado": false
}
Response body — 201 Created
{
  "idVenta": 1,
  "direccionCompra": "Av. Providencia 1234, Santiago",
  "valorCompra": 45000,
  "fechaCompra": "2024-03-15",
  "despachoGenerado": false
}
StatusDescription
201 CreatedSale created successfully. Location header contains the URI of the new resource.
400 Bad RequestValidation failed. Required fields are missing or blank.

GET /api/v1/ventas

Returns a list of all sale records in the system.

Example

curl --request GET \
  --url http://localhost:3001/api/v1/ventas
Response body — 200 OK
[
  {
    "idVenta": 1,
    "direccionCompra": "Av. Providencia 1234, Santiago",
    "valorCompra": 45000,
    "fechaCompra": "2024-03-15",
    "despachoGenerado": false
  },
  {
    "idVenta": 2,
    "direccionCompra": "Calle Falsa 456, Valparaíso",
    "valorCompra": 28000,
    "fechaCompra": "2024-03-16",
    "despachoGenerado": true
  }
]
StatusDescription
200 OKReturns an array of all sales. Returns an empty array when no records exist.

GET /api/v1/ventas/

Returns the details of a single sale by its ID.

Path parameters

idVenta
Long
required
The unique identifier of the sale to retrieve.

Example

curl --request GET \
  --url http://localhost:3001/api/v1/ventas/1
Response body — 200 OK
{
  "idVenta": 1,
  "direccionCompra": "Av. Providencia 1234, Santiago",
  "valorCompra": 45000,
  "fechaCompra": "2024-03-15",
  "despachoGenerado": false
}
StatusDescription
200 OKSale found and returned.
404 Not FoundNo sale exists with the given idVenta.

PUT /api/v1/ventas/

Updates an existing sale with new field values. All body fields are replaced with the provided values.

Path parameters

idVenta
Long
required
The unique identifier of the sale to update.

Body parameters

direccionCompra
string
required
Updated purchase and delivery address. Cannot be blank.
valorCompra
int
Updated purchase value.
fechaCompra
string
required
Updated purchase date in ISO-8601 format (YYYY-MM-DD).
despachoGenerado
boolean
required
Updated dispatch status.

Example

curl --request PUT \
  --url http://localhost:3001/api/v1/ventas/1 \
  --header 'Content-Type: application/json' \
  --data '{
    "direccionCompra": "Av. Providencia 1234, Santiago",
    "valorCompra": 50000,
    "fechaCompra": "2024-03-15",
    "despachoGenerado": true
  }'
Request body
{
  "direccionCompra": "Av. Providencia 1234, Santiago",
  "valorCompra": 50000,
  "fechaCompra": "2024-03-15",
  "despachoGenerado": true
}
Response body — 200 OK
{
  "idVenta": 1,
  "direccionCompra": "Av. Providencia 1234, Santiago",
  "valorCompra": 50000,
  "fechaCompra": "2024-03-15",
  "despachoGenerado": true
}
StatusDescription
200 OKSale updated successfully. Returns the updated object.
400 Bad RequestValidation failed on one or more fields.
404 Not FoundNo sale exists with the given idVenta.

DELETE /api/v1/ventas/

Permanently deletes a sale record. Returns no body on success.

Path parameters

idVenta
Long
required
The unique identifier of the sale to delete.

Example

curl --request DELETE \
  --url http://localhost:3001/api/v1/ventas/1
StatusDescription
204 No ContentSale deleted successfully. No response body.
404 Not FoundNo sale exists with the given idVenta.

Build docs developers (and LLMs) love