REST API
Obtener lista de cámaras
Descripción
Obtener lista de cámaras
Solicitud
GET /api/v1/cameras
Parámetros
Ninguno
Ejemplo de solicitud
http://127.0.0.1:5000/api/v1/cameras
Respuesta
{
"cameras": [
{
"camera_id": "101",
"camera_name": "Camera 101"
},
{
"camera_id": "102",
"camera_name": "Camera 102"
},
{
"camera_id": "103",
"camera_name": "Camera 103"
},
{
"camera_id": "104",
"camera_name": "Camera 104"
},
{
"camera_id": "105",
"camera_name": "Camera 105"
}
]
}
Obtener datos de la cámara por período
Descripción
Obtener datos por período
Solicitud
GET /api/v1/cameras/stats
Parámetros
- camera_id — ID de la cámara (obligatorio)
- date_from — Inicio del período (ISO 8601)
- date_to — Fin del período (ISO 8601)
- interval — Paso de agrupación (month, day, hour, minute)
Ejemplo de solicitud
http://127.0.0.1:5000/api/v1/cameras/stats?camera_id=105&date_from=2025-03-01T00:00&date_to=2025-03-03T23:59&interval=day
Respuesta
{
"data": {
"rows": [
[
"2025-03-01T00:00:00",
259473
],
[
"2025-03-02T00:00:00",
257096
],
[
"2025-03-03T00:00:00",
259665
]
],
"schema": [
"timestamp",
"count"
],
"total": 776234
},
"meta": {
"camera_name": "Camera 105",
"generated_at": "2026-01-31T13:19:28.054289",
"labels": {
"count": "Total Count",
"timestamp": "Timestamp"
},
"row_count": 3,
"source_file": "105.csv"
},
"request": {
"camera_id": "105",
"date_from": "2025-03-01T00:00:00",
"date_to": "2025-03-03T23:59:59",
"interval": "day"
}
}
Ejemplo de solicitud
http://127.0.0.1:5000/api/v1/cameras/stats?camera_id=181&date_from=2024-06-01T00:00&date_to=2024-06-03T23:59&interval=month
Respuesta
{
"data": {
"rows": [
[
"2024-06-01T00:00:00",
21578,
795,
351,
5069,
3914,
343,
5978,
0,
2405,
2502,
0,
0,
0,
74,
61,
86
]
],
"schema": [
"timestamp",
"count",
"type1",
"type2",
"type3",
"type4",
"type5",
"type6",
"type7",
"type8",
"type9",
"type10",
"type11",
"type12",
"type13",
"type14",
"type15"
],
"total": 21578
},
"meta": {
"camera_name": "Camera 181",
"generated_at": "2026-01-31T13:27:34.641367",
"row_count": 1,
"source_file": "181.csv",
"labels": {
"count": "Total Count",
"timestamp": "Timestamp",
"type1": "Product 1",
"type2": "Product 2",
"type3": "Product 3",
"type4": "Product 4",
"type5": "Product 5",
"type6": "Product 6",
"type7": "Product 7",
"type8": "Product 8",
"type9": "Product 9",
"type10": "Product 10",
"type11": "Product 11",
"type12": "Product 12",
"type13": "Product 13",
"type14": "Product 14",
"type15": "Product 15"
}
},
"request": {
"camera_id": "181",
"date_from": "2024-06-01T00:00:00",
"date_to": "2024-06-03T23:59:59",
"interval": "month"
}
}
Dirigirse a una cámara
GET /api/v1.0/qty/{cam}/{start}/{end}
Parameters:
cam – Código de cámara
start – Fecha de inicio del período
end – Fecha de finalización del período
Ejemplo
Request
http://127.0.0.1:5000/api/v1.0/qty?cam=101&start=2024-10-15T00:00&end=2024-10-15T23:59
Response
{
"query_data": {
"end": "Tue, 15 Oct 2024 23:59:00 GMT",
"file_name": "101.csv",
"qty": 50054,
"start": "Tue, 15 Oct 2024 00:00:00 GMT"
}
}
Solicitud a todas las cámaras a la vez
GET /api/v1.0/reports/summary/{start}/{end}
Parameters:
start – Fecha de inicio del período
end – Fecha de finalización del período
Ejemplo
Request
http://127.0.0.1:5000/api/v1.0/reports/summary?start=2024-10-15T00:00&end=2024-10-15T23:59
Response
{
"0": {
"code": "101",
"name": "house 1",
"qty": 50054
},
"1": {
"code": "102",
"name": "house 2",
"qty": 120788
},
"2": {
"code": "103",
"name": "house 3",
"qty": 215394
},
"3": {
"code": "104",
"name": "house 4",
"qty": 273135
},
"4": {
"code": "105",
"name": "house 5",
"qty": 163408
},
"5": {
"code": "106",
"name": "house 6",
"qty": 61035
},
"6": {
"code": "107",
"name": "The main exit",
"qty": 488514
},
"7": {
"code": "209",
"name": "Sorting",
"qty": 0
}
}