Skip to content

search_listings async

search_listings(
    *,
    config_overrides: Optional[AsyncMarketplaceDiscoveryClientConfig] = None,
    locale: Optional[Locale] = None,
    search_text: Optional[SearchText] = None,
    filters: Optional[SearchFilterList] = None,
    max_results: Optional[MaxResults] = None,
    sort_by: Optional[SearchListingsSortBy] = None,
    sort_order: Optional[SearchListingsSortOrder] = None,
    next_token: Optional[NextToken] = None,
) -> SearchListingsOutput

Searches for listings that match your search criteria and filters. You can search by keyword, filter by category, pricing model, fulfillment type, and other attributes, and sort results by relevance or customer rating. The operation returns results in pages. Use nextToken to retrieve the next page.

Parameters:

  • locale (Optional[Locale], default: None ) –

    The preferred locale for response content, as a Best Current Practice 47 (BCP 47) language tag or a comma-separated priority list of language tags. See Locale for supported values, constraints, fallback behavior, and the default locale. If you omit this field, the service returns content in the default locale.

  • search_text (Optional[SearchText], default: None ) –

    The search query text to find relevant listings.

  • filters (Optional[SearchFilterList], default: None ) –

    Filters to narrow search results. A result must match every filter. Within one filter, a result matches if it has any of the values.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of listings to return in each call. If you omit this field, the default is 25. Use nextToken to retrieve the next page.

  • sort_by (Optional[SearchListingsSortBy], default: None ) –

    The field to sort results by. If you do not specify a value, the service sorts by RELEVANCE. This field has one of the following values:

    AVERAGE_CUSTOMER_RATING

    Sorts by average customer rating.

    RELEVANCE

    Sorts by relevance to the search query.

  • sort_order (Optional[SearchListingsSortOrder], default: None ) –

    The sort direction. If you do not specify a value, the service sorts in DESCENDING order. This field has one of the following values:

    ASCENDING

    Sorts from lowest to highest.

    DESCENDING

    Sorts from highest to lowest.

  • next_token (Optional[NextToken], default: None ) –

    If the service returns nextToken, more results are available. The value of nextToken is a unique pagination token for each page. Make the call again with the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. An expired pagination token returns a ValidationException.

Raises:

  • AccessDeniedException –

    You don't have sufficient access to perform this action. Verify that you have the required permissions.

  • InternalServerException –

    Unexpected error during processing of the request.

  • ThrottlingException –

    The request was denied due to request throttling. Reduce the frequency of your requests and retry.

  • ValidationException –

    The input fails to satisfy the constraints specified by the service. Check the reason field for the constraint that failed.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Search for machine learning listings Search for ISO 27001 certified SaaS listings in the machine learning category, sorted by relevance

>>> await client.search_listings(locale='en-US', search_text='computer vision', filters=[{'filterType': 'CATEGORY', 'filterValues': ['machine-learning']}, {'filterType': 'FULFILLMENT_OPTION_TYPE', 'filterValues': ['SAAS']}, {'filterType': 'CERTIFICATES', 'filterValues': ['ISO_27001']}], max_results=25, sort_by='RELEVANCE', sort_order='DESCENDING')
Search listings with a Trust Center source and no certifications
Return Trust Center source information when no certifications are available
>>> await client.search_listings(locale='en-US', search_text='security', filters=[{'filterType': 'TRUST_CENTER', 'filterValues': ['HAS_TRUST_CENTER']}], max_results=1)
Source code in docs_src/capo_marketplace_discovery/_services/async_marketplace_discovery.py
async def search_listings(
    self,
    *,
    config_overrides: Optional[AsyncMarketplaceDiscoveryClientConfig] = None,
    locale: Optional["capo_marketplace_discovery.types.locale.Locale"] = None,
    search_text: Optional[
        "capo_marketplace_discovery.types.search_text.SearchText"
    ] = None,
    filters: Optional[
        "capo_marketplace_discovery.types.search_filter_list.SearchFilterList"
    ] = None,
    max_results: Optional[
        "capo_marketplace_discovery.types.max_results.MaxResults"
    ] = None,
    sort_by: Optional[
        "capo_marketplace_discovery.types.search_listings_sort_by.SearchListingsSortBy"
    ] = None,
    sort_order: Optional[
        "capo_marketplace_discovery.types.search_listings_sort_order.SearchListingsSortOrder"
    ] = None,
    next_token: Optional[
        "capo_marketplace_discovery.types.next_token.NextToken"
    ] = None,
) -> "capo_marketplace_discovery.types.search_listings_output.SearchListingsOutput":
    """<p>Searches for listings that match your search criteria and filters. You can search by keyword, filter by category, pricing model, fulfillment type, and other attributes, and sort results by relevance or customer rating. The operation returns results in pages. Use <code>nextToken</code> to retrieve the next page.</p>

    Args:
        locale: <p>The preferred locale for response content, as a Best Current Practice 47 (BCP 47) language tag or a comma-separated priority list of language tags. See <code>Locale</code> for supported values, constraints, fallback behavior, and the default locale. If you omit this field, the service returns content in the default locale.</p>
        search_text: <p>The search query text to find relevant listings.</p>
        filters: <p>Filters to narrow search results. A result must match every filter. Within one filter, a result matches if it has any of the values.</p>
        max_results: <p>The maximum number of listings to return in each call. If you omit this field, the default is 25. Use <code>nextToken</code> to retrieve the next page.</p>
        sort_by: <p>The field to sort results by. If you do not specify a value, the service sorts by <code>RELEVANCE</code>. This field has one of the following values:</p> <dl> <dt>AVERAGE_CUSTOMER_RATING</dt> <dd> <p>Sorts by average customer rating.</p> </dd> <dt>RELEVANCE</dt> <dd> <p>Sorts by relevance to the search query.</p> </dd> </dl>
        sort_order: <p>The sort direction. If you do not specify a value, the service sorts in <code>DESCENDING</code> order. This field has one of the following values:</p> <dl> <dt>ASCENDING</dt> <dd> <p>Sorts from lowest to highest.</p> </dd> <dt>DESCENDING</dt> <dd> <p>Sorts from highest to lowest.</p> </dd> </dl>
        next_token: <p>If the service returns <code>nextToken</code>, more results are available. The value of <code>nextToken</code> is a unique pagination token for each page. Make the call again with the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. An expired pagination token returns a <code>ValidationException</code>.</p>

    Raises:
        capo_marketplace_discovery.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action. Verify that you have the required permissions.</p>
        capo_marketplace_discovery.errors.internal_server_exception.InternalServerException: <p>Unexpected error during processing of the request.</p>
        capo_marketplace_discovery.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Reduce the frequency of your requests and retry.</p>
        capo_marketplace_discovery.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service. Check the <code>reason</code> field for the constraint that failed.</p>
        capo_marketplace_discovery.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Search for machine learning listings
        Search for ISO 27001 certified SaaS listings in the machine learning category, sorted by relevance

        >>> await client.search_listings(locale='en-US', search_text='computer vision', filters=[{'filterType': 'CATEGORY', 'filterValues': ['machine-learning']}, {'filterType': 'FULFILLMENT_OPTION_TYPE', 'filterValues': ['SAAS']}, {'filterType': 'CERTIFICATES', 'filterValues': ['ISO_27001']}], max_results=25, sort_by='RELEVANCE', sort_order='DESCENDING')
        Search listings with a Trust Center source and no certifications
        Return Trust Center source information when no certifications are available

        >>> await client.search_listings(locale='en-US', search_text='security', filters=[{'filterType': 'TRUST_CENTER', 'filterValues': ['HAS_TRUST_CENTER']}], max_results=1)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_marketplace_discovery.types.search_listings_input.SearchListingsInput]",
    ) -> AsyncOperationResponse[
        "capo_marketplace_discovery.types.search_listings_output.SearchListingsOutput"
    ]:
        import capo_marketplace_discovery._operations.aws_marketplace_discovery.search_listings

        (
            output,
            http_response,
        ) = await capo_marketplace_discovery._operations.aws_marketplace_discovery.search_listings.async_search_listings(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SearchListings")
    )
    input_: capo_marketplace_discovery.types.search_listings_input.SearchListingsInput = {}
    if locale is not None:
        input_["locale"] = locale
    if search_text is not None:
        input_["search_text"] = search_text
    if filters is not None:
        input_["filters"] = filters
    if max_results is not None:
        input_["max_results"] = max_results
    if sort_by is not None:
        input_["sort_by"] = sort_by
    if sort_order is not None:
        input_["sort_order"] = sort_order
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output