Stay organized with collections
Save and categorize content based on your preferences.
Full name: projects.locations.datasets.fhirStores.fhir.Observation-lastn
Retrieves the N most recent Observation resources for a subject matching search criteria specified as query parameters, grouped by Observation.code, sorted from most recent to oldest.
Implements the FHIR extended operation Observation-lastn (STU3, R4, R5).
DSTU2 doesn't define the Observation-lastn method, but the server supports it the same way it supports STU3.
Search terms are provided as query parameters following the same pattern as the search method. The following search parameters must be provided:
- `subject` or `patient` to specify a subject for the Observation.
- `code`, `category` or any of the composite parameters that include
`code`.
Any other valid Observation search parameters can also be provided. This operation accepts an additional query parameter max, which specifies N, the maximum number of Observations to return from each group, with a default of 1.
Searches with over 1000 results are rejected. Results are counted before grouping and limiting the results with max. To stay within the limit, constrain these searches using Observation search parameters such as _lastUpdated or date.
On success, the response body contains a JSON-encoded representation of a Bundle resource of type searchset, containing the results of the operation. Errors generated by the FHIR store contain a JSON-encoded OperationOutcome resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead.
HTTP request
GET https://healthcare.googleapis.com/v1beta1/{parent=projects/*/locations/*/datasets/*/fhirStores/*}/fhir/Observation/$lastn
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-23 UTC."],[[["\u003cp\u003eThis API endpoint, \u003ccode\u003eObservation-lastn\u003c/code\u003e, retrieves the N most recent \u003ccode\u003eObservation\u003c/code\u003e resources for a given subject, grouped by \u003ccode\u003eObservation.code\u003c/code\u003e and sorted by recency.\u003c/p\u003e\n"],["\u003cp\u003eIt supports FHIR's extended \u003ccode\u003eObservation-lastn\u003c/code\u003e operation as defined in both STU3 and R4 standards, while also offering support for it in DSTU2, although not formally specified.\u003c/p\u003e\n"],["\u003cp\u003eRequired search parameters include either \u003ccode\u003esubject\u003c/code\u003e or \u003ccode\u003epatient\u003c/code\u003e to identify the subject, and either \u003ccode\u003ecode\u003c/code\u003e, \u003ccode\u003ecategory\u003c/code\u003e, or any composite parameter including \u003ccode\u003ecode\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003emax\u003c/code\u003e query parameter specifies how many Observations to return per group, defaulting to 1, and the search is limited to a maximum of 1000 results before grouping and the \u003ccode\u003emax\u003c/code\u003e parameter is applied.\u003c/p\u003e\n"],["\u003cp\u003eThe API returns a \u003ccode\u003eBundle\u003c/code\u003e resource of type \u003ccode\u003esearchset\u003c/code\u003e on success, and requires the \u003ccode\u003ehealthcare.fhirResources.search\u003c/code\u003e IAM permission along with one of the specified OAuth scopes for authorization.\u003c/p\u003e\n"]]],[],null,[]]