QUERY 是要在搜索中使用的自由文本查询。查询可以包含与 API Hub 资源的任何详细信息(包括显示名称、说明或其他元数据)相关的关键字。
RESOURCE_TYPE 是为搜索指定的可选过滤条件。您可以将以下 API Hub 资源类型之一指定为过滤条件:
Api
ApiOperation
Deployment
Definition
Spec
Version
例如:
curl-XPOSThttps://apihub.googleapis.com/v1/projects/{project-id}/locations/{location}:searchResources \-H"Authorization: Bearer $(gcloud auth print-access-token)"-H"Content-Type: application/json"\
-d'{"query":"dog status in the store","filter":"resource_type = SPEC"}'
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-28。"],[[["\u003cp\u003eThis page outlines how to use Semantic Search, powered by Vertex AI, and filter-based options to efficiently search for resources within Apigee and Apigee hybrid's API hub.\u003c/p\u003e\n"],["\u003cp\u003eSemantic Search enables free-text queries to find APIs, versions, specifications, operations, and deployments based on semantically similar terms found in the API resource entries.\u003c/p\u003e\n"],["\u003cp\u003eUsers can search using system or user attributes and refine search results by filtering and clicking on categories in the results, such as APIs, Versions, Specifications, Operations, and Deployments.\u003c/p\u003e\n"],["\u003cp\u003eYou can also use an API call to search resources, where you can specify a query and filter the results by resource type.\u003c/p\u003e\n"],["\u003cp\u003eFilter options allow you to narrow the displayed APIs based on attributes like API name, business unit, team, and documentation, with the ability to use \u003ccode\u003eMatch ALL\u003c/code\u003e or \u003ccode\u003eMatch ANY\u003c/code\u003e criteria.\u003c/p\u003e\n"]]],[],null,["# Search for and filter APIs\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\nThis topic describes how to use Semantic Search powered by [Vertex AI](/vertex-ai/docs) and filter-based search options to search\nfor specific resources in API hub.\n**Figure 1.** API hub provides powerful natural language search and filter features.\n\nSearch API hub using Semantic Search\n------------------------------------\n\nYou can easily find and view API resources registered in your API hub using Semantic Search. Semantic Search allows\nyou to search all available API resources in your instance using a *free-text search query*. You can search across all entity types (APIs, API operations, specifications, and more.),\nor specify the entity type that you want to query.\n\nWith its Vertex AI search engine, Semantic Search can go beyond term \"matching.\" Semantic Search returns results\ncontaining terms found anywhere in the detailed API resource entries that are semantically similar to the free text search queries entered.\n\nFree-text search returns the following categories of results:\n\n- **APIs** : A list of APIs that match the search. For each API, the following details are provided:\n - The name of the API with a link to the API details page.\n - A brief description of the resource.\n - The name and email address of the resource owner.\n- **Versions** : A list of API versions that match the search. For each version, the following details are provided:\n - The names of the APIs associated with the version, with a link that takes you to the API details page.\n - The name of the API version, with a link that takes you to the version details page.\n - The description of the version and related metadata.\n- **Specifications** : A list of API specifications that match the search. For each specification, the following details are provided:\n - The names of the API associated with the specification, with a link that takes you to the API details page.\n - The name of the API specification, with a link that takes you to the version details page associated with the specification.\n - The description of the specification.\n - A link to the specification document.\n - The type of specification, such as OpenAPI spec.\n- **Operations** : A list of API operations that match the search. For each operation, the following details are provided:\n - The names of the API associated with the operation, with a link that takes you to the API details page.\n - The name of the operation, with a link that takes you to the version details page associated with the operation.\n - The description of the specification.\n - A link to the specification document that defines the operation.\n - A link to the version that includes the operation.\n- **Deployments** : A list of deployments that match the search. For each deployment, the following details are provided:\n - The name of the deployment.\n - The description of the deployment.\n - The deployment type. For example, Apigee hybrid.\n - A link to the version that includes the deployment.\n\n\u003cbr /\u003e\n\nTo search for APIs containing a specific term:\n\n1. In the Google Cloud console, go to the API hub **Semantic search** page.\n\n [Go to API hub](https://console.cloud.google.com//apigee/api-hub/search)\n2. Type a search query in the search box.\n\n For example, you could enter \"Order management APIs\" or \"Spec file for wireless carrier settings\".\n\n You can refine your search by using [system attributes](/apigee/docs/apihub/manage-attributes#system-attributes) within your search query prompt. If you created\n [user attributes](/apigee/docs/apihub/manage-attributes#user-attributes) when registering your APIs in API hub, you can also incorporate these attributes in your search query prompts.\n3. The **Search results** are categorized under the following tabs: APIs, Versions, Specifications, Operations, and Deployments. Click one of the tabs to see results for a category. The results display API resources that contain terms semantically similar to the search query you entered.\n4. Click the API resource name to view the detail page for the resource.\n5. To clear the current query, click **Clear results**.\n\nSearch API hub using the API\n----------------------------\n\nYou can also search your API hub resources using the API hub API. The `searchResources` method\nallows you to query your API hub resources using free text queries and filters.\n\nYou can use the following API call to search across your API hub resources: \n\n```carbon\ncurl -X POST https://apihub.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e:searchResources \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" -H \"Content-Type: application/json\" \\\n -d '{\n \"query\":\"\u003cvar translate=\"no\"\u003eQUERY\u003c/var\u003e\",\n \"filter\":\"resource_type = \u003cvar translate=\"no\"\u003eRESOURCE_TYPE\u003c/var\u003e\"\n }'\n```\n\nWhere:\n\n- **PROJECT_ID** is the ID of the host project for your API hub instance.\n- **LOCATION** is the location where your API hub instance is hosted.\n- **QUERY** is the free text query to be used in the search. The query can contain keywords related to any detail of the API hub resource, including display names, descriptions, or other metadata..\n- **RESOURCE_TYPE** is the optional filter specified for your search. You can specify one of the following API hub resource types as a filter:\n - `Api`\n - `ApiOperation`\n - `Deployment`\n - `Definition`\n - `Spec`\n - `Version`\n\n\u003cbr /\u003e\n\nFor example: \n\n```carbon\ncurl -X POST https://apihub.googleapis.com/v1/projects/{project-id}/locations/{location}:searchResources \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" -H \"Content-Type: application/json\" \\\n -d '{\n \"query\":\"dog status in the store\",\n \"filter\":\"resource_type = SPEC\"\n }'\n```\n\nThis call returns a paginated list of API hub resources, with resource-specific metadata.\n\nFor more information on free-text search with the API hub API, see the API reference documentation for\n[`Method:project.locations.searchResources`](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations/searchResources).\n\nFilter-based search options\n---------------------------\n\n\u003cbr /\u003e\n\nYou can refine the list of APIs displayed on the **APIs** page by using system attributes as search parameters.\nCustomize\nthe list of API resources displayed using one of the following:\n\n- [Filter](#filter)\n- [Pagination](#pagination)\n\n### Filter\n\nUsing the filter-based list search, you can streamline your APIs list based on a number of predefined parameters and\nsystem attributes associated with the resource. You can use the `Match ALL` or `Match ANY` options\nto customize your filtered view.\n| **Note:** The filter options available are configured by a user with [administrator permissions](/apigee/docs/apihub/iam-roles). For more information, see [Manage API hub settings](/apigee/docs/apihub/settings-overview) and [Manage attributes](/apigee/docs/apihub/manage-attributes).\n\n\nTo specify filter options:\n\n1. In the Google Cloud console, go to the API hub **APIs** page.\n\n [Go to API hub APIs](https://console.cloud.google.com//apigee/api-hub/apis)\n2. Click in the **Filter table** field to filter the table. The **Filter** pane opens. **Tip:**You can show or hide columns in the APIs table. Use the action menu in the Filter row to select and unselect row names.\n3. Specify or select filter options. When you type in the Filter pane, a menu with filter options pops up that includes a list of [system attributes](/apigee/docs/apihub/manage-attributes#system-attributes) that are relevant to the current context. For example, these are system attributes that you may see when filtering the APIs in the **APIs** page:\n - **API name**: The display name of the API\n - **Business unit:** The business unit responsible for an API\n - **Team:** The producing team responsible for an API\n - **Documentation**: A short link to the API documentation.\n | **Note:** There may be additional attributes listed as filter options. For more information, see [Manage API attributes](/apigee/docs/apihub/manage-attributes).\n - You'll see system attributes in the filter list in the **APIs** , **Versions** , and **Specifications** tables.\n4. After selecting a filter option, select a filter value from the **Values** list. Alternatively, you can enter a value for the filter attribute you select.\n5. To add an additional filter, click in the **Filter table** field to select from the available **Operators** and then select another filter attribute and value.\n6. The selected filter properties display the conditional\n logic that the filter query is using. You can select `OR` as an operator. If no\n operator is selected, the default is `AND`.\n\n7. To clear an individual filter, click the **X** on the filter. To clear all filters, click **Clear all** in the **Filter** pane.\n\n### Pagination\n\nWhen there are multiple API resources, they may be displayed across multiple pages.\n\nTo customize the list display and navigate between pages:\n\n1. In the Google Cloud console, go to the API hub **APIs** page.\n\n [Go to API hub APIs](https://console.cloud.google.com//apigee/api-hub/apis)\n\n The **APIs** list page is displayed by default.\n2. From the **APIs** list, locate the pagination tools\n as shown in Figure 2:\n\n **Figure 2.** Move back and forth through paginated results.\n3. Select the number of APIs to display per page.\n4. Click **\\\u003e Forward**to go to the next page.\n5. Click**\\\u003c Back**to go to the previous page.\n\nWhat's next?\n------------\n\n- Learn how to [Manage deployments](/apigee/docs/apihub/manage-api-deployments)."]]