Get last observations
Retrieve recent FHIR Observation resources, optionally scoped to a patient, limited by count, and filtered by observation codes.
| Method | Path |
|---|---|
GET | /fhir/R4/Observation/$lastn |
Request
These query parameters are optional. Provide patient when you want results scoped to a patient.
| Parameter | Type | Description |
|---|---|---|
patient | string | Patient reference, for example Patient/:patient-id. |
max | string | Maximum number of observations to return. |
code | string | Comma-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 path | Example | Meaning |
|---|---|---|
resourceType | Bundle | Identifies the outer FHIR resource. |
type | searchset | Indicates the Bundle contains search results. |
entry[].fullUrl | https://api.sandbox.ovok.com/fhir/R4/Observation/<observation-id> | Canonical URL identifying the returned Observation. |
entry[].resource.resourceType | Observation | Each entry contains an Observation resource. |
entry[].resource.id | <observation-id> | ID of the returned Observation. |
entry[].resource.status | final | Clinical status of the observation. |
entry[].resource.subject.reference | Patient/<patient-id> | Patient associated with the observation. |
entry[].resource.code.coding[0] | http://loinc.org / 8886-4 | Code system and code identifying what was measured. |
entry[].resource.valueQuantity | 72 bpm | Example 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 status | Meaning |
|---|---|
200 | Request succeeded; the body is a searchset Bundle. |
400 | The request could not be operated on by the server. Check query parameters and their values. |
401 | The resource owner or authorization server denied the request. Check the access token and its permissions. |
404 | A requested resource could not be found. Check the patient reference and route. |
422 | The server could not validate the request. Check FHIR references and parameter formats. |
500 | The 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.