Search and filter APIs

This page applies to Apigee and Apigee hybrid.

This topic describes how to use Smart Search powered by Vertex AI and filter-based search options to search for specific resources in API hub.

You can easily find and view API resources registered in your API hub using Smart Search. Smart Search allows you 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, etc.), or specify the entity type that you want to query.

With its Vertex AI search engine, Smart Search can go beyond term "matching." Smart Search returns results containing terms found anywhere in the detailed API resource entries that are semantically similar to the free text search queries entered.

Free-text search returns a paginated list of search results that include the following details:

  • Resource name: The name of the API, API operation, or specification file.
  • Resource description: A brief description of the resource.
  • Resource owner: The name and email address of the resource owner.
  • Resource detail link: A link to the detailed information page for the resource.

To search for APIs containing a specific term:

  1. In the Google Cloud console, go to the API hub Discover page.

    Go to API hub Discover

  2. Type a search query in the search box.

    For example, you could enter, "Order management APIs" or "Spec file for wireless carrier settings".

    You can refine your search by using system attributes within your search query prompt. If you created user attributes when registering your APIs in API hub, you can also incorporate these attributes in your search query prompts.

  3. The Search results list will display a list of API resources that contain terms semantically similar to the search query you entered.
  4. Click the API resource name to view the detail page for the resource.
  5. To clear the current query, click Clear results.

You can also search your API hub resources using the API hub API. The searchResources method allows you to query your API hub resources using free text queries and filters.

You can use the following API call to search across your API hub resources:

curl -X POST https://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":"QUERY",
    "filter":"resource_type = RESOURCE_TYPE"
   }'

Where:

  • PROJECT_ID is the ID of the host project for your API hub instance.
  • LOCATION is the location where your API hub instance is hosted.
  • 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..
  • RESOURCE_TYPE is the optional filter specified for your search. You can specify one of the following API hub resource types as a filter:
    • Api
    • ApiOperation
    • Deployment
    • Definition
    • Spec
    • Version

For example:

curl -X POST https://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"
    }'

This call returns a paginated list of API hub resources, including the following:

  • The display name of the resource.
  • A description of the resource.
  • A link to documentation about the resourcs.
  • The owner of the resource.

If additional system attributes or user attributes are configured for the resource, the metadata associated with the attributes is also returned.

For more information on free-text search with the API hub API, see the API reference documentation for Method:project.locations.searchResources.

Filter-based search options

You can refine the list of APIs displayed on the APIs page by using system attributes as search parameters. If you created user attributes when registering your APIs in API hub, you can also incorporate these attributes in your search queries. Customize the list of API resources displayed using one of the following:

Filter

Using the filter-based list search, you can streamline your APIs list based on a number of predefined parameters and system attributes associated with the resource. You can use the Match ALL or Match ANY options to customize your filtered view.

To specify filter options:

  1. In the Google Cloud console, go to the API hub APIs page.

    Go to API hub APIs

  2. Click in the Filter table field to filter the table. The Filter pane opens.
  3. Specify or select filter options from the following:
    • API name: The display name of the API
    • Documentation: A short link to the API documentation.
  4. 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.
  5. 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.
  6. The selected filter properties display the conditional logic that the filter query is using. You can select OR as an operator. If no operator is selected, the default is AND.

  7. To clear an individual filter, click the X on the filter. To clear all filters, click Clear all in the Filter pane.

Sort

To reorder the list of APIs displayed:

  1. In the Google Cloud console, go to the API hub APIs page.

    Go to API hub APIs

    The APIs list page is displayed by default.

  2. From the APIs list page, locate the API name column heading.
  3. The arrow indicates the current sort priority. A down arrow indicates descending alphabetical order. An up arrow indicates ascending alphabetical order.
  4. Click API name to sort the APIs list by name.

Pagination

When there are multiple API resources, they may be displayed across multiple pages.

To customize the list display and navigate between pages:

  1. In the Google Cloud console, go to the API hub APIs page.

    Go to API hub APIs

    The APIs list page is displayed by default.

  2. From the APIs list, locate the pagination tools as shown below:

  3. Select the number of APIs to display per page.
  4. Click > Forward to go to the next page.
  5. Click < Back to go to the previous page.

What's next?