Webhook-based subscriptions are the preferred method for receiving real-time notifications from Health Gorilla. However, if webhooks are not feasible in your environment, polling can be used as a fallback to periodically check for new or updated resources.
Note: Polling is less efficient than webhooks, increases API load, and introduces latency. Use it only when webhook delivery is not possible.
How Polling Works
Polling involves sending GET
requests to the FHIR API to retrieve recently created or updated resources. This is typically done at regular intervals using the _lastUpdated
query parameter.
Example Polling Request
GET /fhir/DocumentReference?status=current&_lastUpdated=ge2024-11-01T00:00:00Z
Authorization: Bearer {access_token}
Accept: application/fhir+json
This request returns all DocumentReference
resources with a status=current
and a lastUpdated
timestamp on or after midnight, November 1, 2024.
Polling Recommendations
- Use
_lastUpdated=ge{timestamp}
to avoid redundant data. - Store the timestamp of the last successful poll in your system.
- Avoid polling more frequently than every 5 minutes unless specifically permitted.
- Consider including pagination with
_count
andnext
links to manage large result sets.
Resource Types Commonly Polled
Resource Type | Recommended Filters |
---|---|
DocumentReference | status=current + _lastUpdated |
Encounter | status=finished + _lastUpdated |
Observation | code=xxx + _lastUpdated (lab-specific) |
Immunization | status=completed + _lastUpdated |
Caveats and Limitations
- Polling does not guarantee immediate delivery of updates.
- If data is delayed from external networks, your application may miss recent records without reconciliation.
- Polling is subject to rate limits. Excessive or inefficient polling may result in throttling.