API integration¶
Programmatic read access to scan results, tracks, metrics, and asset metadata for ETL pipelines, BI tools, and custom dashboards.
This section documents the Data API implemented in rda_back under src/api/features/data_api/. It complements the operator-focused pages elsewhere in this site.
Overview¶
| Item | Value |
|---|---|
| Base path | {API_V1_PREFIX}/data/* (default /api/data/*) |
| Methods | GET and POST (async exports only) — read-only data access |
| Auth | API key (machine-to-machine) or JWT (user session) |
| Scope | Zone-scoped — keys and users only see locations, sources, and scans in assigned zones |
Typical dev setup:
| Service | URL |
|---|---|
| Frontend (Vite) | http://localhost:3000 (proxies /api → backend) |
| API directly | http://localhost:9006/api |
Set RDA_API_BASE_URL to the full API base including prefix (for example http://localhost:9006/api).
Quick start¶
- Create an API key (on the server):
cd rda_back
python scripts/create_api_key.py --name "ETL" --zone-id <zoneObjectId>
The full key (rda_live_…) is shown once. Store it securely.
- Discover assets:
export RDA_API_BASE_URL=http://localhost:9006/api
export RDA_API_KEY=rda_live_…
curl -s -H "Authorization: Bearer $RDA_API_KEY" \
"$RDA_API_BASE_URL/data/assets" | jq .
- List tracks for a scan:
curl -s -H "Authorization: Bearer $RDA_API_KEY" \
"$RDA_API_BASE_URL/data/scans/{scanId}/tracks?limit=1000" | jq .
In this section¶
- Authentication — API keys, JWT, zone scoping
- Data API reference — endpoints, parameters, pagination
- Examples and CLI — curl recipes and
fetch_integration_data.py
Backend reference¶
| Resource | Location |
|---|---|
| Route handlers | rda_back/src/api/features/data_api/router.py |
| Mongo access | rda_back/src/api/features/data_api/dao.py |
| API keys | rda_back/src/api/features/data_api/api_keys.py |
| Async exports | rda_back/src/api/features/data_api/export_jobs.py |
| Design notes | rda_back/docs/ThirdPartyIntegrationApi.md |
| Curl examples | rda_back/docs/integration-examples.md |
Related pages¶
- Administrator — deployment and ports
- Class groups — labels used in track data