Method: fhir.Observation-lastn

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).

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

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


The URL uses gRPC Transcoding syntax.

Path parameters



Required. Name of the FHIR store to retrieve resources from.

Authorization requires the following IAM permission on the specified resource parent:


Request body

The request body must be empty.

Response body

If successful, the response is a generic HTTP response whose format is defined by the method.

Authorization scopes

Requires one of the following OAuth scopes:


For more information, see the Authentication Overview.