Skip to main content
GET
/
api
/
dashboard-admin
/
tendencia
Request Trends
curl --request GET \
  --url https://api.example.com/api/dashboard-admin/tendencia
{
  "500": {},
  "status": "<string>",
  "data": [
    {
      "mes": "<string>",
      "total": 123,
      "fecha_orden": "<string>"
    }
  ]
}

Overview

This endpoint returns time-series data showing request trends over a specified number of months. It groups requests by month and provides counts, enabling trend analysis and visualization.

Authentication

Requires JWT authentication token. Typically used by admins for analytics and reporting.

Query Parameters

meses
integer
default:"6"
Number of months to look back. Defaults to 6 months if not specified.
empleado_id
integer
Optional employee ID. If provided, returns trends for that employee only. If omitted, returns organization-wide trends.

Response

status
string
Response status (“success”)
data
array
Array of monthly trend objects, ordered chronologically from oldest to newest
mes
string
Month and year label (e.g., “Jan 2026”, “Feb 2026”)
total
integer
Total count of requests created in that month
fecha_orden
string
Minimum creation date for sorting purposes (ISO format)

Error Responses

500
object
Internal server error
{
  "status": "error",
  "message": "Error al obtener tendencia."
}

Code Examples

Last 6 Months (Default)

cURL
curl -X GET 'https://api.example.com/api/dashboard-admin/tendencia' \
  -H 'Authorization: Bearer YOUR_JWT_TOKEN'
JavaScript
// Get last 6 months trend (organization-wide)
const response = await fetch('https://api.example.com/api/dashboard-admin/tendencia', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_JWT_TOKEN',
    'Content-Type': 'application/json'
  }
});

const trends = await response.json();

// Display trend data
trends.data.forEach(month => {
  console.log(`${month.mes}: ${month.total} requests`);
});

// Extract data for chart
const labels = trends.data.map(m => m.mes);
const values = trends.data.map(m => m.total);
console.log('Chart labels:', labels);
console.log('Chart values:', values);
Python
import requests
import matplotlib.pyplot as plt

# Get last 6 months trend
url = 'https://api.example.com/api/dashboard-admin/tendencia'
headers = {
    'Authorization': 'Bearer YOUR_JWT_TOKEN',
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)
data = response.json()['data']

# Display trend
for month in data:
    print(f"{month['mes']}: {month['total']} requests")

# Plot trend chart
labels = [m['mes'] for m in data]
values = [m['total'] for m in data]

plt.figure(figsize=(10, 6))
plt.plot(labels, values, marker='o')
plt.title('Request Trends (Last 6 Months)')
plt.xlabel('Month')
plt.ylabel('Number of Requests')
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()

Custom Time Range

cURL
curl -X GET 'https://api.example.com/api/dashboard-admin/tendencia?meses=12' \
  -H 'Authorization: Bearer YOUR_JWT_TOKEN'
JavaScript
// Get last 12 months trend
const months = 12;
const response = await fetch(
  `https://api.example.com/api/dashboard-admin/tendencia?meses=${months}`,
  {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_JWT_TOKEN',
      'Content-Type': 'application/json'
    }
  }
);

const trends = await response.json();
console.log(`Trend data for last ${months} months:`, trends.data);
Python
import requests

# Get last 12 months trend
url = 'https://api.example.com/api/dashboard-admin/tendencia'
params = {'meses': 12}
headers = {
    'Authorization': 'Bearer YOUR_JWT_TOKEN',
    'Content-Type': 'application/json'
}

response = requests.get(url, params=params, headers=headers)
data = response.json()['data']

print(f"Trend data for last {params['meses']} months:")
for month in data:
    print(f"  {month['mes']}: {month['total']}")
cURL
curl -X GET 'https://api.example.com/api/dashboard-admin/tendencia?meses=6&empleado_id=42' \
  -H 'Authorization: Bearer YOUR_JWT_TOKEN'
JavaScript
// Get employee-specific trend
const employeeId = 42;
const response = await fetch(
  `https://api.example.com/api/dashboard-admin/tendencia?meses=6&empleado_id=${employeeId}`,
  {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_JWT_TOKEN',
      'Content-Type': 'application/json'
    }
  }
);

const trends = await response.json();
console.log(`Request trends for employee ${employeeId}:`, trends.data);
Python
import requests

# Get employee-specific trend
employee_id = 42
url = 'https://api.example.com/api/dashboard-admin/tendencia'
params = {
    'meses': 6,
    'empleado_id': employee_id
}
headers = {
    'Authorization': 'Bearer YOUR_JWT_TOKEN',
    'Content-Type': 'application/json'
}

response = requests.get(url, params=params, headers=headers)
data = response.json()['data']

print(f"Trends for employee {employee_id}:")
for month in data:
    print(f"  {month['mes']}: {month['total']} requests")

Example Responses

6-Month Organization Trend

{
  "status": "success",
  "data": [
    {
      "mes": "Oct 2025",
      "total": 42,
      "fecha_orden": "2025-10-01T00:00:00.000Z"
    },
    {
      "mes": "Nov 2025",
      "total": 38,
      "fecha_orden": "2025-11-01T00:00:00.000Z"
    },
    {
      "mes": "Dec 2025",
      "total": 65,
      "fecha_orden": "2025-12-01T00:00:00.000Z"
    },
    {
      "mes": "Jan 2026",
      "total": 28,
      "fecha_orden": "2026-01-01T00:00:00.000Z"
    },
    {
      "mes": "Feb 2026",
      "total": 35,
      "fecha_orden": "2026-02-01T00:00:00.000Z"
    },
    {
      "mes": "Mar 2026",
      "total": 18,
      "fecha_orden": "2026-03-01T00:00:00.000Z"
    }
  ]
}

Employee-specific 6-Month Trend

{
  "status": "success",
  "data": [
    {
      "mes": "Oct 2025",
      "total": 2,
      "fecha_orden": "2025-10-05T00:00:00.000Z"
    },
    {
      "mes": "Nov 2025",
      "total": 1,
      "fecha_orden": "2025-11-12T00:00:00.000Z"
    },
    {
      "mes": "Dec 2025",
      "total": 3,
      "fecha_orden": "2025-12-02T00:00:00.000Z"
    },
    {
      "mes": "Jan 2026",
      "total": 1,
      "fecha_orden": "2026-01-15T00:00:00.000Z"
    },
    {
      "mes": "Feb 2026",
      "total": 2,
      "fecha_orden": "2026-02-08T00:00:00.000Z"
    },
    {
      "mes": "Mar 2026",
      "total": 1,
      "fecha_orden": "2026-03-03T00:00:00.000Z"
    }
  ]
}

Visualization Examples

Line Chart

Create a line chart to visualize request volume trends over time

Area Chart

Use an area chart to emphasize cumulative volume trends

Bar Chart

Display monthly volumes as bars for easy comparison

Sparkline

Show compact inline trend visualization in dashboards or tables

Use Cases

Trend Analysis

Identify seasonal patterns or growth/decline trends in request submissions

Forecasting

Use historical trends to predict future request volumes for resource planning

Performance Reports

Include trend charts in monthly or quarterly reports to stakeholders

Employee Activity

Track individual employee request patterns over time

Notes

  • Data is aggregated by month and ordered chronologically
  • Months with zero requests may not appear in the response
  • The fecha_orden field is used internally for sorting and typically not displayed to users
  • Time range is calculated backwards from the current date using SQL Server’s DATEADD function

Build docs developers (and LLMs) love