Skip to main content

Get last observations

Retrieve recent FHIR Observation resources, optionally scoped to a patient, limited by count, and filtered by observation codes.

MethodPath
GET/fhir/R4/Observation/$lastn

Request​

These query parameters are optional. Provide patient when you want results scoped to a patient.

ParameterTypeDescription
patientstringPatient reference, for example Patient/:patient-id.
maxstringMaximum number of observations to return.
codestringComma-separated observation codes, for example 131328,8886-4.
curl --get 'https://api.sandbox.ovok.com/fhir/R4/Observation/$lastn' \
--header "Authorization: Bearer ${OVOK_TOKEN}" \
--data-urlencode "patient=Patient/${PATIENT_ID}" \
--data-urlencode 'max=2' \
--data-urlencode 'code=131328,8886-4'

--get places the supplied values in the URL query string. Set OVOK_TOKEN to an access token authorized for the requested patient data.

Successful response​

The operation returns a FHIR Bundle with type: searchset. Each entry contains an Observation and its canonical fullUrl.

Response pathExampleMeaning
resourceTypeBundleIdentifies the outer FHIR resource.
typesearchsetIndicates the Bundle contains search results.
entry[].fullUrlhttps://api.sandbox.ovok.com/fhir/R4/Observation/<observation-id>Canonical URL identifying the returned Observation.
entry[].resource.resourceTypeObservationEach entry contains an Observation resource.
entry[].resource.id<observation-id>ID of the returned Observation.
entry[].resource.statusfinalClinical status of the observation.
entry[].resource.subject.referencePatient/<patient-id>Patient associated with the observation.
entry[].resource.code.coding[0]http://loinc.org / 8886-4Code system and code identifying what was measured.
entry[].resource.valueQuantity72 bpmExample measurement and unit. Other value types may be used.

The returned fields depend on the stored Observation. Each entry's resource contains one matching Observation.

Responses and errors​

HTTP statusMeaning
200Request succeeded; the body is a searchset Bundle.
400The request could not be operated on by the server. Check query parameters and their values.
401The resource owner or authorization server denied the request. Check the access token and its permissions.
404A requested resource could not be found. Check the patient reference and route.
422The server could not validate the request. Check FHIR references and parameter formats.
500The server encountered an unexpected condition. Retry later or provide the request ID to support.

Errors are returned as an OperationOutcome; its issue entries describe the failure. Exact diagnostics depend on the request and server state.