web / app/api/v1/events/stats/route
app/api/v1/events/stats/route
Unified API route for aggregating event counts by various fields.
Returns event counts grouped by a specified field (catalog, dataset, etc.) with optional filtering by date range and geographic bounds. Uses PostgreSQL GROUP BY aggregation for high performance.
Variables
GET()
constGET: (request,context) =>Promise<Response>
GET handler for event aggregation.
Query Parameters:
- groupBy (required): Field to group by (‘catalog’ | ‘dataset’)
- catalog (optional): Filter by catalog ID
- datasets (optional): Filter by dataset IDs (comma-separated)
- startDate (optional): Filter events >= this date
- endDate (optional): Filter events <= this date (inclusive)
- bounds (optional): Geographic bounding box (JSON string)
Parameters
request
NextRequest
context
unknown
Returns
Promise<Response>
Last updated on