**Full name**: projects.locations.datasets.consentStores.evaluateUserConsents

Evaluates the user's `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Consent` for all matching `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.userDataMappings#UserDataMapping`.

Note: User data mappings are indexed asynchronously, which can cause a slight delay between the time mappings are created or updated and when they are included in consentStores.evaluateUserConsents results.

### HTTP request

`POST https://healthcare.googleapis.com/v1/{consentStore=projects/*/locations/*/datasets/*/consentStores/*}:evaluateUserConsents`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `consentStore` | `string` Required. Name of the consent store to retrieve User data mappings from. Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `consentStore`: - `healthcare.consentStores.evaluateUserConsents` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "userId": string, "resourceAttributes": { string: string, ... }, "requestAttributes": { string: string, ... }, "responseView": enum(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores/evaluateUserConsents#ResponseView`), "pageSize": integer, "pageToken": string, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "consentList": { object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/ConsentList`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `userId` | `string` Required. User ID to evaluate consents for. |
| `resourceAttributes` | `map (key: string, value: string)` Optional. The values of resource attributes associated with the resources being requested. If no values are specified, then all resources are queried. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `requestAttributes` | `map (key: string, value: string)` Required. The values of request attributes associated with this access request. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `responseView` | ``enum(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores/evaluateUserConsents#ResponseView`)`` Optional. The view for `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores/evaluateUserConsents#body.EvaluateUserConsentsResponse`. If unspecified, defaults to `BASIC` and returns `consented` as `TRUE` or `FALSE`. |
| `pageSize` | `integer` Optional. Limit on the number of User data mappings to return in a single response. If not specified, 100 is used. May not be larger than 1000. |
| `pageToken` | `string` Optional. Token to retrieve the next page of results, or empty to get the first page. |
| The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `consentList` | ``object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/ConsentList`)`` Optional. Specific `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Consent` to evaluate the access request against. These Consents must have the same `userId` as the User data mappings being evalauted, must exist in the current `consentStore`, and must have a `state` of either `ACTIVE` or `DRAFT`. A maximum of 100 Consents can be provided here. If unspecified, all `ACTIVE` unexpired Consents in the current `consentStore` will be evaluated. |
| End of mutually exclusive fields. ||

### Response body

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "results": [ { object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores/evaluateUserConsents#Result`) } ], "nextPageToken": string } ``` |

| Fields ||
|---|---|
| `results[]` | ``object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores/evaluateUserConsents#Result`)`` The consent evaluation result for each `dataId`. |
| `nextPageToken` | `string` Token to retrieve the next page of results, or empty if there are no more results in the list. This token is valid for 72 hours after it is created. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-healthcare`
- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

## ResponseView

The supported views for `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores/evaluateUserConsents#body.EvaluateUserConsentsResponse`.

| Enums ||
|---|---|
| `RESPONSE_VIEW_UNSPECIFIED` | No response view specified. The API will default to the BASIC view. |
| `BASIC` | Only the `dataId` and `consented` fields are populated in the response. |
| `FULL` | All fields within the response are populated. When set to `FULL`, all `ACTIVE` Consents are evaluated even if a matching policy is found during evaluation. |

## Result

The consent evaluation result for a single `dataId`.

| JSON representation |
|---|
| ``` { "dataId": string, "consented": boolean, "consentDetails": { string: { object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/ConsentEvaluation`) }, ... } } ``` |

| Fields ||
|---|---|
| `dataId` | `string` The unique identifier of the evaluated resource. |
| `consented` | `boolean` Whether the resource is consented for the given use. |
| `consentDetails` | ``map (key: string, value: object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/ConsentEvaluation`))`` The resource names of all evaluated `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Consent` mapped to their evaluation. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |