Bufdir Aggregation Service
API Contract
REST
/api/v1/bufdir-aggregations
6 endpoints
GET
/api/v1/bufdir-aggregations/api/v1/bufdir-aggregations
List aggregated metrics snapshots for the organization
Public
Response Example
{
"data": [
{
"id": "agg-001",
"org_id": "org-bufdir-42",
"reporting_period_id": "rp-2024-q4",
"status": "completed",
"participant_count": 1842,
"hours_delivered": 9310.5,
"activity_count": 274,
"created_at": "2025-01-05T08:00:00Z",
"refreshed_at": "2025-01-05T08:12:43Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 3
}
}
GET
/api/v1/bufdir-aggregations/api/v1/bufdir-aggregations/:id
Get a single aggregation result by ID
Public
Response Example
{
"id": "agg-001",
"org_id": "org-bufdir-42",
"reporting_period_id": "rp-2024-q4",
"status": "completed",
"participant_count": 1842,
"hours_delivered": 9310.5,
"activity_count": 274,
"bufdir_category_breakdown": {
"foreldre_barn": 312,
"ungdom": 580,
"eldre": 210,
"funksjonsnedsettelse": 740
},
"created_at": "2025-01-05T08:00:00Z",
"refreshed_at": "2025-01-05T08:12:43Z"
}
POST
/api/v1/bufdir-aggregations/api/v1/bufdir-aggregations
Trigger a new aggregation run for an organization and reporting period
Public
Request Example
{
"org_id": "org-bufdir-42",
"reporting_period_id": "rp-2025-q1"
}
Response Example
{
"id": "agg-009",
"org_id": "org-bufdir-42",
"reporting_period_id": "rp-2025-q1",
"status": "processing",
"created_at": "2025-03-26T09:00:00Z",
"refreshed_at": null
}
PUT
/api/v1/bufdir-aggregations/api/v1/bufdir-aggregations/:id
Refresh or update an existing aggregation snapshot
Public
Request Example
{
"org_id": "org-bufdir-42",
"reporting_period_id": "rp-2024-q4",
"force_refresh": true
}
Response Example
{
"id": "agg-001",
"org_id": "org-bufdir-42",
"reporting_period_id": "rp-2024-q4",
"status": "completed",
"participant_count": 1855,
"hours_delivered": 9402,
"refreshed_at": "2025-03-26T09:15:00Z"
}
DELETE
/api/v1/bufdir-aggregations/api/v1/bufdir-aggregations/:id
Delete an aggregation snapshot
Public
Response Example
{
"deleted": true,
"id": "agg-001"
}
GET
/api/v1/bufdir-aggregations/api/v1/bufdir-aggregations/:id/metrics
Get detailed aggregated metrics for an org/period
Public
Response Example
{
"org_id": "org-bufdir-42",
"period_id": "rp-2024-q4",
"total_participants": 1842,
"unique_participants": 1601,
"total_hours": 9310.5,
"total_activities": 274,
"category_distribution": {
"foreldre_barn": {
"participants": 312,
"hours": 1560
},
"ungdom": {
"participants": 580,
"hours": 3100
}
}
}