Skip to main content
GET
/
api
/
reports
/
by-cadena
Reports by Chain
curl --request GET \
  --url https://api.example.com/api/reports/by-cadena
{
  "name": "<string>",
  "cantidad": 123,
  "costo": 123
}

Overview

Retrieve scrap records grouped by production chain (cadena) to analyze which production lines are generating the most waste.

Authentication

Requires valid JWT token with view_area_reports or view_global_reports permission.
Authorization: Bearer <token>

Query Parameters

fecha_inicio
string
Start date filter (YYYY-MM-DD format or ISO datetime)
fecha_fin
string
End date filter (YYYY-MM-DD format or ISO datetime)

Request Example

curl -X GET "http://localhost:3001/api/reports/by-cadena?fecha_inicio=2024-03-01&fecha_fin=2024-03-31" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

Returns an array of chain statistics ordered by cost (descending).
name
string
Production chain identifier (CADENA value)
cantidad
number
Total scrap quantity for this chain
costo
number
Total scrap cost for this chain

Response Example

[
  {
    "name": "GNT1",
    "cantidad": 350,
    "costo": 12450.75
  },
  {
    "name": "HNS2",
    "cantidad": 290,
    "costo": 10230.50
  },
  {
    "name": "WC3",
    "cantidad": 245,
    "costo": 8975.25
  }
]

By Area

Scrap aggregated by area

By Shift

Scrap aggregated by shift

Build docs developers (and LLMs) love