- [HTTP request](https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#body.SearchResourcesResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#body.aspect_1)
- [SearchResult](https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#SearchResult)
  - [JSON representation](https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#SearchResult.SCHEMA_REPRESENTATION)
- [ApiHubResource](https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#ApiHubResource)
  - [JSON representation](https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#ApiHubResource.SCHEMA_REPRESENTATION)

Search across API-Hub resources.

### HTTP request

`POST https://apihub.googleapis.com/v1/{location=projects/*/locations/*}:searchResources`

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

### Path parameters

| Parameters ||
|---|---|
| `location` | `string` Required. The resource name of the location which will be of the type `projects/{projectId}/locations/{locationId}`. This field is used to identify the instance of API-Hub in which resources should be searched. |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "query": string, "filter": string, "pageSize": integer, "pageToken": string } ``` |

| Fields ||
|---|---|
| `query` | `string` Required. The free text search query. This query can contain keywords which could be related to any detail of the API-Hub resources such display names, descriptions, attributes etc. |
| `filter` | `string` Optional. An expression that filters the list of search results. A filter expression consists of a field name, a comparison operator, and a value for filtering. The value must be a string, a number, or a boolean. The comparison operator must be `=`. Filters are not case sensitive. The following field names are eligible for filtering: \* `resource_type` - The type of resource in the search results. Must be one of the following: `Api`, `ApiOperation`, `Deployment`, `Definition`, `Spec` or `Version`. This field can only be specified once in the filter. Here are is an example: - `resource_type = Api` - The resource_type is *Api*. |
| `pageSize` | `integer` Optional. The maximum number of search results to return. The service may return fewer than this value. If unspecified at most 10 search results will be returned. If value is negative then `INVALID_ARGUMENT` error is returned. The maximum value is 25; values above 25 will be coerced to 25. While paginating, you can specify a new page size parameter for each page of search results to be listed. |
| `pageToken` | `string` Optional. A page token, received from a previous \[locations.searchResources\]\[locations.searchResources\] call. Specify this parameter to retrieve the next page of transactions. When paginating, you must specify the `pageToken` parameter and all the other parameters except `https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#body.request_body.FIELDS.page_size` should be specified with the same value which was used in the previous call. If the other fields are set with a different value than the previous call then `INVALID_ARGUMENT` error is returned. |

### Response body

Response for the `https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#google.cloud.apihub.v1.ApiHub.SearchResources` method.

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

| JSON representation |
|---|
| ``` { "searchResults": [ { object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#SearchResult`) } ], "nextPageToken": string } ``` |

| Fields ||
|---|---|
| `searchResults[]` | ``object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#SearchResult`)`` List of search results according to the filter and search query specified. The order of search results represents the ranking. |
| `nextPageToken` | `string` Pass this token in the `SearchResourcesRequest` to continue to list results. If all results have been returned, this field is an empty string or not present in the response. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/apihub.readonly`
- `
  https://www.googleapis.com/auth/apihub.readwrite`
- `
  https://www.googleapis.com/auth/cloud-platform`

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `location` resource:

- `apihub.apis.list`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).

## SearchResult

Represents the search results.

| JSON representation |
|---|
| ``` { "resource": { object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#ApiHubResource`) } } ``` |

| Fields ||
|---|---|
| `resource` | ``object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources#ApiHubResource`)`` This represents the ApiHubResource. Note: Only selected fields of the resources are populated in response. |

## ApiHubResource

ApiHubResource is one of the resources such as Api, Operation, Deployment, Definition, Spec and Version resources stored in API-Hub.

| JSON representation |
|---|
| ``` { // Union field `resource` can be only one of the following: "api": { object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis#Api`) }, "operation": { object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.operations#ApiOperation`) }, "deployment": { object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.deployments#Deployment`) }, "spec": { object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.specs#Spec`) }, "definition": { object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.definitions#Definition`) }, "version": { object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions#Version`) } // End of list of possible types for union field `resource`. } ``` |

| Fields ||
|---|---|
| Union field `resource`. `resource` can be only one of the following: ||
| `api` | ``object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis#Api`)`` This represents Api resource in search results. Only name, displayName, description and owner fields are populated in search results. |
| `operation` | ``object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.operations#ApiOperation`)`` This represents ApiOperation resource in search results. Only name, description, spec and details fields are populated in search results. |
| `deployment` | ``object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.deployments#Deployment`)`` This represents Deployment resource in search results. Only name, displayName, description, deploymentType and apiVersions fields are populated in search results. |
| `spec` | ``object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.specs#Spec`)`` This represents Spec resource in search results. Only name, displayName, description, specType and documentation fields are populated in search results. |
| `definition` | ``object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.definitions#Definition`)`` This represents Definition resource in search results. Only name field is populated in search results. |
| `version` | ``object (`https://docs.cloud.google.com/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions#Version`)`` This represents Version resource in search results. Only name, displayName, description, lifecycle, compliance and accreditation fields are populated in search results. |