REST /api/v1/export-queries 3 endpoints
POST /api/v1/export-queries/api/v1/export-queries/activity

Build and execute an activity query for export

Public

Request Example

{
  "scope_ids": [
    "ch_071",
    "ch_072",
    "ch_073"
  ],
  "date_range": {
    "from": "2025-01-01",
    "to": "2025-12-31"
  }
}

Response Example

{
  "query_id": "qry_act_20260326_001",
  "row_count": 1247,
  "rows": [
    {
      "activity_id": "act_8801",
      "chapter_id": "ch_071",
      "activity_type_id": "act_type_01",
      "mentor_id": "usr_1021",
      "youth_id": "yth_4421",
      "date": "2025-03-12",
      "duration_hours": 2
    },
    {
      "activity_id": "act_8802",
      "chapter_id": "ch_071",
      "activity_type_id": "act_type_02",
      "mentor_id": "usr_1021",
      "youth_id": "yth_4422",
      "date": "2025-03-14",
      "duration_hours": 3.5
    }
  ],
  "executed_at": "2026-03-26T10:12:00Z"
}
POST /api/v1/export-queries/api/v1/export-queries/mentor

Build and execute a mentor participation query

Public

Request Example

{
  "scope_ids": [
    "ch_071",
    "ch_072"
  ]
}

Response Example

{
  "query_id": "qry_mtr_20260326_001",
  "row_count": 83,
  "rows": [
    {
      "mentor_id": "usr_1021",
      "mentor_name": "Kari Andersen",
      "chapter_id": "ch_071",
      "chapter_name": "Stavanger Røde Kors"
    },
    {
      "mentor_id": "usr_1042",
      "mentor_name": "Lars Eriksen",
      "chapter_id": "ch_072",
      "chapter_name": "Sandnes Røde Kors"
    }
  ],
  "executed_at": "2026-03-26T10:12:05Z"
}
POST /api/v1/export-queries/api/v1/export-queries/rollup

Build and execute a rollup totals query for a scope

Public

Request Example

{
  "scope_id": "scope_region_07",
  "level": "region"
}

Response Example

{
  "query_id": "qry_rlp_20260326_001",
  "scope_id": "scope_region_07",
  "level": "region",
  "totals": {
    "total_activities": 1247,
    "total_hours": 9832.5,
    "total_mentors": 83,
    "total_youth": 412
  },
  "executed_at": "2026-03-26T10:12:08Z"
}

Additional Metadata

{
  "contract_summary": {
    "total_contracts": 410,
    "total_endpoints": 2416,
    "api_styles_used": [
      "rest"
    ]
  },
  "generated_at": "2026-03-26T06:55:53.316Z"
}