# Method: groups.memberships.searchDirectGroups

Searches direct groups of a member.

Groups for which the actor does not have the permission to view memberships are silently filtered out.

### HTTP request

`GET https://cloudidentity.googleapis.com/v1/{parent=groups/*}/memberships:searchDirectGroups`

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

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` [Resource name](https://cloud.google.com/apis/design/resource_names) of the group to search transitive memberships in. Format: groups/{groupId}, where groupId is always '-' as this API will search across all groups for a given member. |

### Query parameters

| Parameters ||
|---|---|
| `query` | `string` Required. A CEL expression that MUST include member specification AND label(s). Users can search on label attributes of groups. CONTAINS match ('in') is supported on labels. Identity-mapped groups are uniquely identified by both a `member_key_id` and a `member_key_namespace`, which requires an additional query input: `member_key_namespace`. Example query: `member_key_id == 'member_key_id_value' && 'label_value' in labels` |
| `pageSize` | `integer` The default page size is 200 (max 1000). |
| `pageToken` | `string` The `next_page_token` value returned from a previous list request, if any |
| `orderBy` | `string` The ordering of membership relation for the display name or email in the response. The syntax for this field can be found at <https://cloud.google.com/apis/design/design_patterns#sorting_order>. Example: Sort by the ascending display name: order_by="group_name" or order_by="group_name asc". Sort by the descending display name: order_by="group_name desc". Sort by the ascending group key: order_by="group_key" or order_by="group_key asc". Sort by the descending group key: order_by="group_key desc". |

### Request body

The request body must be empty.

### Response body

The response message for `https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/searchDirectGroups#google.apps.cloudidentity.groups.v1.MembershipsService.SearchDirectGroups`.

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

| JSON representation |
|---|
| ``` { "memberships": [ { object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/searchDirectGroups#MembershipRelation`) } ], "nextPageToken": string } ``` |

| Fields ||
|---|---|
| `memberships[]` | ``object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships/searchDirectGroups#MembershipRelation`)`` List of direct groups satisfying the query. |
| `nextPageToken` | `string` Token to retrieve the next page of results, or empty if there are no more results available for listing. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-identity.groups.readonly`
- `https://www.googleapis.com/auth/cloud-identity.groups`
- `https://www.googleapis.com/auth/cloud-identity`
- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authorization guide](https://developers.google.com/workspace/guides/configure-oauth-consent).

## MembershipRelation

Message containing membership relation.

| JSON representation |
|---|
| ``` { "membership": string, "roles": [ { object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#MembershipRole`) } ], "group": string, "groupKey": { object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/EntityKey`) }, "displayName": string, "labels": { string: string, ... }, "description": string } ``` |

| Fields ||
|---|---|
| `membership` | `string` The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Membership`. Shall be of the form `groups/{group_id}/memberships/{membership_id}`. |
| `roles[]` | ``object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups.memberships#MembershipRole`)`` The `MembershipRole`s that apply to the `Membership`. |
| `group` | `string` The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Group`. Shall be of the form `groups/{group_id}`. |
| `groupKey` | ``object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1/EntityKey`)`` The `EntityKey` of the `Group`. |
| `displayName` | `string` The display name of the `Group`. |
| `labels` | `map (key: string, value: string)` One or more label entries that apply to the Group. Currently supported labels contain a key with an empty value. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `description` | `string` An extended description to help users determine the purpose of a `Group`. |