curl --request GET \
--url https://api.example.com/api/dashboard-admin/kpis{
"500": {},
"status": "<string>",
"data": {
"solicitudes_pendientes": 123,
"ausentes_hoy": 123,
"dias_vacaciones_otorgados_ytd": 123,
"plantilla_activa": 123,
"empleado_nombre": "<string>"
}
}Retrieve key performance indicators for admin dashboard or specific employee
curl --request GET \
--url https://api.example.com/api/dashboard-admin/kpis{
"500": {},
"status": "<string>",
"data": {
"solicitudes_pendientes": 123,
"ausentes_hoy": 123,
"dias_vacaciones_otorgados_ytd": 123,
"plantilla_activa": 123,
"empleado_nombre": "<string>"
}
}{
"status": "error",
"message": "Error al obtener indicadores."
}
curl -X GET 'https://api.example.com/api/dashboard-admin/kpis' \
-H 'Authorization: Bearer YOUR_JWT_TOKEN'
// Get organization-wide KPIs
const response = await fetch('https://api.example.com/api/dashboard-admin/kpis', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN',
'Content-Type': 'application/json'
}
});
const kpis = await response.json();
console.log(`Pending requests: ${kpis.data.solicitudes_pendientes}`);
console.log(`Absent today: ${kpis.data.ausentes_hoy}`);
console.log(`Vacation days YTD: ${kpis.data.dias_vacaciones_otorgados_ytd}`);
console.log(`Active employees: ${kpis.data.plantilla_activa}`);
import requests
# Organization-wide KPIs
url = 'https://api.example.com/api/dashboard-admin/kpis'
headers = {
'Authorization': 'Bearer YOUR_JWT_TOKEN',
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
kpis = response.json()['data']
print(f"Pending requests: {kpis['solicitudes_pendientes']}")
print(f"Absent today: {kpis['ausentes_hoy']}")
print(f"Vacation days YTD: {kpis['dias_vacaciones_otorgados_ytd']}")
print(f"Active employees: {kpis['plantilla_activa']}")
curl -X GET 'https://api.example.com/api/dashboard-admin/kpis?empleado_id=42' \
-H 'Authorization: Bearer YOUR_JWT_TOKEN'
// Get employee-specific KPIs
const employeeId = 42;
const response = await fetch(
`https://api.example.com/api/dashboard-admin/kpis?empleado_id=${employeeId}`,
{
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN',
'Content-Type': 'application/json'
}
}
);
const kpis = await response.json();
console.log(`Employee: ${kpis.data.empleado_nombre}`);
console.log(`Their pending requests: ${kpis.data.solicitudes_pendientes}`);
console.log(`Absent today: ${kpis.data.ausentes_hoy === 1 ? 'Yes' : 'No'}`);
import requests
# Employee-specific KPIs
employee_id = 42
url = f'https://api.example.com/api/dashboard-admin/kpis'
params = {'empleado_id': employee_id}
headers = {
'Authorization': 'Bearer YOUR_JWT_TOKEN',
'Content-Type': 'application/json'
}
response = requests.get(url, params=params, headers=headers)
kpis = response.json()['data']
print(f"Employee: {kpis['empleado_nombre']}")
print(f"Their pending requests: {kpis['solicitudes_pendientes']}")
print(f"Absent today: {'Yes' if kpis['ausentes_hoy'] == 1 else 'No'}")
print(f"Vacation days YTD: {kpis['dias_vacaciones_otorgados_ytd']}")
{
"status": "success",
"data": {
"solicitudes_pendientes": 15,
"ausentes_hoy": 8,
"dias_vacaciones_otorgados_ytd": 342,
"plantilla_activa": 125,
"empleado_nombre": null
}
}
{
"status": "success",
"data": {
"solicitudes_pendientes": 2,
"ausentes_hoy": 0,
"dias_vacaciones_otorgados_ytd": 10,
"plantilla_activa": null,
"empleado_nombre": "Juan Pérez González"
}
}