Export SQLQuery Library results asynchronously using the FHIR Asynchronous Interaction Request Pattern.
Use Cases:
- Large-scale SQL query execution against ViewDefinition tables
- Long-running analytical queries that would time out synchronously
- Batch export of multiple query results in a single operation
- Exporting queries with inline ViewDefinition table sources
Endpoints:
| Level | Endpoint | Query Source |
|---|---|---|
| System | POST [base]/$sqlquery-export |
query parameter (1..*) |
| Type | POST [base]/Library/$sqlquery-export |
query parameter (1..*) |
| Instance | POST [base]/Library/[id]/$sqlquery-export |
Bound Library resource |
Execution Flow:
- Client sends request with
Prefer: respond-asyncheader - Server returns
202 AcceptedwithContent-Locationpolling URL - Client polls for status until the poll returns
303 See Otherwith the result URL in theLocationheader - Client fetches the result URL, which returns the manifest with
200 OK - Client downloads exported files from the
output.locationURLs in the manifest
This operation combines the query source and parameter binding from
$sqlquery-run with the asynchronous
export pattern from $viewdefinition-export.
Key Features:
- Multiple queries per export via the repeating
queryparameter — each with its own parameters - ViewDefinition table sources via the
viewparameter — supply ViewDefinitions referenced in the Library'srelatedArtifactentries (materialized as tables for SQL to query; only SQL query results appear in the export output) - Per-query parameters — each
queryrepetition can have its ownparametersresource