# Method: opportunities.query

- [HTTP request](https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities/query#body.HTTP_TEMPLATE)
- [Query parameters](https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities/query#body.QUERY_PARAMETERS)
- [Request body](https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities/query#body.request_body)
- [Response body](https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities/query#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities/query#body.QueryOpportunitiesResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities/query#body.aspect)
- [Try it!](https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities/query#try-it)

Query `https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities#Opportunity`s associated with a specific Partner.

Possible error codes:

- PERMISSION_DENIED: The user making the request isn't allowed to list opportunities associated with the given partner.
- INVALID_ARGUMENT: Required request parameters are missing or invalid.

Return value: `https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities#Opportunity`s the user has access to, or an empty list if there are no opportunities.

### HTTP request

`GET https://cloudchannel.googleapis.com/v1alpha1/opportunities:query`

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

### Query parameters

| Parameters ||
|---|---|
| `partner` | `string` Required. Provide the Partner ID for which the Opportunities are being queried. Format: partner = partners/{id} |
| `pageSize` | `integer` Optional. The maximum number of opportunities to return. The service might return fewer than this value. If unspecified, at most 50 opportunities are returned. The maximum value is 100; values above 100 are coerced to 100. |
| `pageToken` | `string` Optional. A page token, received from a previous `opportunities.query` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `opportunities.query` must match the call that provided the page token. |
| `filter` | `string` Optional. Filters on the `https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities#Opportunity`. Currently supports filtering on the following fields: - `state` - `stage` - `partnerInfo.rebate_expiration_date` - `salesCycle.close_date` - `source` - `customerDisplayName` - `partnerInfo.incentive_eligibility` - `qualificationInfo.campaign_code` - `updateTime` For information on the filter format, see <https://google.aip.dev/160>. |
| `orderBy` | `string` Optional. Sort order of the `https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities#Opportunity`. Currently supports sorting on the following fields: - `state` - `stage` - `partnerInfo.rebate_expiration_date` - `salesCycle.close_date` - `source` - `opportunityInfo.display_name` - `customerDisplayName` - `opportunityInfo.product_category` - `updateTime` For information on the sort format, see <https://google.aip.dev/132#ordering>. |

### Request body

The request body must be empty.

### Response body

Response message for `https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities/query#google.cloud.channel.v1alpha1.CloudChannelService.QueryOpportunities`

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

| JSON representation |
|---|
| ``` { "opportunities": [ { object (`https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities#Opportunity`) } ], "nextPageToken": string, "totalSize": integer } ``` |

| Fields ||
|---|---|
| `opportunities[]` | ``object (`https://docs.cloud.google.com/channel/docs/reference/rest/v1alpha1/opportunities#Opportunity`)`` The opportunities for the specified partner. |
| `nextPageToken` | `string` A token, which can be sent as `pageToken` to retrieve the next page. If this field is omitted, there are no subsequent pages. |
| `totalSize` | `integer` Total Number of Opportunties for the given filter. |

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/apps.order`

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