Stay organized with collections
Save and categorize content based on your preferences.
Full name: projects.locations.datasets.fhirStores.applyConsents
Apply the Consent resources for the FHIR store and reindex the underlying resources in the FHIR store according to the aggregate consent. The aggregate consent of the patient in scope in this request replaces any previous call of this method. Any Consent resource change after this operation execution (including deletion) requires you to call fhirStores.applyConsents again to have effect.
This method returns an Operation that can be used to track the progress of the consent resources that were processed by calling operations.get. Upon completion, the ApplyConsentsResponse additionally contains the number of resources that was reindexed.
Required. The name of the FHIR store to enforce, in the format projects/{projectId}/locations/{locationId}/datasets/{datasetId}/fhirStores/{fhirStoreId}.
Authorization requires the following IAM permission on the specified resource name:
healthcare.fhirStores.applyConsents
Request body
The request body contains data with the following structure:
JSON representation
{"validateOnly": boolean,// Union field scope can be only one of the following:"patientScope": {object(PatientScope)},"timeRange": {object(TimeRange)}// End of list of possible types for union field scope.}
Fields
validateOnly
boolean
Optional. If true, the method only validates Consent resources to make sure they are supported. When the operation completes, ApplyConsentsResponse is returned where consentApplySuccess and consentApplyFailure indicate supported and unsupported (or invalid) Consent resources, respectively. Otherwise, the method propagates the aggregate consensual information to the patient's resources. Upon success, affectedResources in the ApplyConsentsResponse indicates the number of resources that may have consensual access changed.
Union field scope. Scope down to one of the following: a list of patients, a time range, or a consent enforcement version. scope can be only one of the following:
Optional. Scope down to patients whose most recent consent changes are in the time range. Can only be used with a versioning store (i.e. when disableResourceVersioning is set to false).
Response body
If successful, the response body contains an instance of Operation.
Optional. The list of patient IDs whose Consent resources will be enforced. At most 10,000 patients can be specified. An empty list is equivalent to all patients (meaning the entire FHIR store).
TimeRange
Apply consents given by patients whose most recent consent changes are in the time range. Note that after identifying these patients, the server applies all Consent resources given by those patients, not just the Consent resources within the timestamp in the range.
JSON representation
{"start": string,"end": string}
Fields
start
string
Optional. The earliest consent change time, in format YYYY-MM-DDThh:mm:ss.sss+zz:zz If not specified, the system uses the FHIR store creation time.
end
string
Optional. The latest consent change time, in format YYYY-MM-DDThh:mm:ss.sss+zz:zz If not specified, the system uses the time when [fhirStores.applyConsents][] was called.
[[["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 method, \u003ccode\u003efhirStores.applyConsents\u003c/code\u003e, applies Consent resources to a FHIR store, reindexing resources based on the aggregate patient consent.\u003c/p\u003e\n"],["\u003cp\u003eSubsequent changes to Consent resources require re-running \u003ccode\u003efhirStores.applyConsents\u003c/code\u003e to take effect, replacing any prior method call results.\u003c/p\u003e\n"],["\u003cp\u003eThe process' progress can be tracked via an \u003ccode\u003eOperation\u003c/code\u003e, and upon completion, an \u003ccode\u003eApplyConsentsResponse\u003c/code\u003e indicates the number of reindexed resources.\u003c/p\u003e\n"],["\u003cp\u003eYou can optionally validate Consent resources without applying them by setting \u003ccode\u003evalidateOnly\u003c/code\u003e to \u003ccode\u003etrue\u003c/code\u003e, and consent enforcement is enabled for the FHIR store when \u003ccode\u003econsentConfig.access_enforced\u003c/code\u003e is true.\u003c/p\u003e\n"],["\u003cp\u003eYou can define a \u003ccode\u003escope\u003c/code\u003e of \u003ccode\u003epatientScope\u003c/code\u003e or \u003ccode\u003etimeRange\u003c/code\u003e for the consents to be enforced on.\u003c/p\u003e\n"]]],[],null,["# Method: fhirStores.applyConsents\n\n**Full name**: projects.locations.datasets.fhirStores.applyConsents\n\nApply the Consent resources for the FHIR store and reindex the underlying resources in the FHIR store according to the aggregate consent. The aggregate consent of the patient in scope in this request replaces any previous call of this method. Any Consent resource change after this operation execution (including deletion) requires you to call [fhirStores.applyConsents](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores/applyConsents#google.cloud.healthcare.v1.fhir.FhirStoreService.ApplyConsents) again to have effect.\n\nThis method returns an [Operation](/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation) that can be used to track the progress of the consent resources that were processed by calling `operations.get`. Upon completion, the [ApplyConsentsResponse](/healthcare-api/docs/reference/rest/Shared.Types/ApplyConsentsResponse) additionally contains the number of resources that was reindexed.\n\nErrors are logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).\n\nTo enforce consent check for data access, `consentConfig.access_enforced` must be set to true for the [FhirStore](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores#FhirStore).\n\nFHIR Consent is not supported in DSTU2 or R5.\n\n### HTTP request\n\n`POST https://healthcare.googleapis.com/v1/{name=projects/*/locations/*/datasets/*/fhirStores/*}:applyConsents`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nIf successful, the response body contains an instance of [Operation](/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/cloud-healthcare`\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp).\n\nPatientScope\n------------\n\nApply consents given by a list of patients.\n\nTimeRange\n---------\n\nApply consents given by patients whose most recent consent changes are in the time range. Note that after identifying these patients, the server applies all Consent resources given by those patients, not just the Consent resources within the timestamp in the range."]]