Search System
The FHIR system-level search operation allows you to search across all resource types on the FHIR server. This is done using an HTTP GET request to the root endpoint with query parameters.
- CLI
- TypeScript
- cURL
Search across all resource types using the Haste Health CLI:
haste-health api search-system "_sort=_lastUpdated"
This command searches across every resource type, sorted by last-updated time.
You can also perform a system-level search without parameters:
haste-health api search-system
Search across all resource types using the TypeScript client:
import { AsynchronousClient } from '@haste-health/client';
import { R4 } from '@haste-health/fhir-types/versions';
// Assuming you have a configured client
const client: AsynchronousClient<{}> = /* ... */;
const searchResults = await client.search_system(
{},
R4,
'_type=Patient,Observation'
);
console.log('Total matches:', searchResults.total);
console.log('Resources found:', searchResults.resources);
// You can also use parsed parameters
import { parseQuery } from '@haste-health/client/url';
const searchWithParsed = await client.search_system(
{},
R4,
parseQuery('_sort=_lastUpdated')
);
Search across all resource types using cURL:
curl -X GET "https://api.haste.health/w/[tenant]/[project]/api/v1/fhir?_sort=_lastUpdated" \
-H "Content-Type: application/fhir+json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Replace [tenant] with your tenant name and [project] with your project ID.
_elements and _summary
_elements=field1,field2 returns only the named top-level fields (plus a resource's always-present elements); _summary=true|text|count returns the SMART-defined summary subset, the narrative only, or just a match count.
haste-health api search-system "_summary=count"
_include/_revinclude are not currently supported at the system level — they only apply to a type-level search.
Error Handling
If there are any issues with the request (e.g., invalid search parameters), the server will respond with an appropriate error status code and include an OperationOutcome resource in the response body.
HTTP/1.1 400 Bad Request
Content-Type: application/fhir+json
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "invalid",
"diagnostics": "Invalid search parameter: unknown_param"
}
]
}