Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/akibanks/tienda_musica_web/llms.txt

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

VinylVibes exposes two user-specific endpoints for tracking purchase and browsing activity. GET /mis-compras returns the full order history for the authenticated user and is used to populate the “Mis Compras” side panel in the storefront. POST /historial records vinyl view events automatically when a user opens an album’s detail modal, and these events are used by the backend to power personalized recommendations via GET /disco/{id}/recomendaciones.

GET /mis-compras

Authentication: Required — Authorization: Bearer <token> Returns the complete purchase history for the authenticated user, ordered from most to least recent. Each order includes its status, total, city, and a full list of the vinyl records purchased.

cURL Example

curl https://api-tienda-vinilos.onrender.com/mis-compras \
  -H 'Authorization: Bearer <token>'

Response

Returns an array of order objects.
id_venta
integer
Unique order ID.
estado
string
Current order status. One of: pendiente, pagada, enviada, entregada, or cancelada.
total
number
Order total (e.g., 59.98).
fecha
string
ISO 8601 timestamp of when the order was placed.
ciudad
string
Destination city from the shipping address, displayed alongside the order date in the UI.
discos
array
Array of vinyl records included in this order.

Response Example

[
  {
    "id_venta": 42,
    "estado": "enviada",
    "total": 59.98,
    "fecha": "2025-05-20T14:23:00Z",
    "ciudad": "Ciudad de México",
    "discos": [
      {
        "titulo": "Kind of Blue",
        "artista": "Miles Davis",
        "cantidad": 2,
        "subtotal": 59.98
      }
    ]
  }
]

POST /historial

Authentication: Required — Authorization: Bearer <token> Records a vinyl view event for the authenticated user. This endpoint is called automatically by the frontend (_registrarHistorial in script.js) whenever a logged-in user opens the album detail modal. The backend uses the accumulated view history to generate personalized recommendations surfaced through GET /disco/{id}/recomendaciones.

Request Body

discogs_id
string
required
The Discogs release ID of the vinyl that was viewed.
titulo
string
required
Album title.
artista
string
required
Artist name.
genero
string
Primary genre of the album, or null if not available.
estilo
string
Style/subgenre of the album, or null if not available.

Request Body Example

{
  "discogs_id": "12345",
  "titulo": "Kind of Blue",
  "artista": "Miles Davis",
  "genero": "Jazz",
  "estilo": null
}

cURL Example

curl -X POST https://api-tienda-vinilos.onrender.com/historial \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <token>' \
  -d '{"discogs_id":"12345","titulo":"Kind of Blue","artista":"Miles Davis","genero":"Jazz","estilo":null}'

How the Frontend Calls This Endpoint

The following code is taken directly from script.js (_registrarHistorial function):
await fetch(`${API}/historial`, {
    method:  'POST',
    headers: authHeaders(),
    body:    JSON.stringify({
        discogs_id: disco.discogs_id,
        titulo:     disco.titulo,
        artista:    disco.artista || '',
        genero:     disco.genero  || null,
        estilo:     disco.estilo  || null,
    }),
});
If the user is not logged in, the frontend silently skips the POST /historial call entirely — no token means no request is made, and no error is surfaced to the user.

Build docs developers (and LLMs) love