Skip to content

search_listings

search_listings(
    *,
    config_overrides: Optional[MarketplaceDiscoveryClientConfig] = 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

Returns a list of product listings based on 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.

Parameters:

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

    A BCP 47 language tag or comma-separated priority list specifying the preferred locale for response content. See Locale for supported values, constraints, fallback behavior, and the default locale. If omitted, 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. Multiple filters are combined with AND logic. Multiple values within the same filter are combined with OR logic.

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

    The maximum number of results that are returned per call. You can use nextToken to get more results.

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

    The field to sort results by. Valid values are RELEVANCE and AVERAGE_CUSTOMER_RATING.

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

    The sort direction. Valid values are DESCENDING and ASCENDING.

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

    If nextToken is returned, there are more results available. Make the call again using the returned token to retrieve the next page.

Raises:

Examples:

Search for machine learning listings Search for SaaS listings in the machine learning category with sorting by relevance

>>> client.search_listings(locale='en-US', search_text='computer vision', filters=[{'filterType': 'CATEGORY', 'filterValues': ['machine-learning']}, {'filterType': 'FULFILLMENT_OPTION_TYPE', 'filterValues': ['SAAS']}], max_results=25, sort_by='RELEVANCE', sort_order='DESCENDING')
Source code in docs_src/capo_marketplace_discovery/_services/marketplace_discovery.py
def search_listings(
    self,
    *,
    config_overrides: Optional[MarketplaceDiscoveryClientConfig] = 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>Returns a list of product listings based on 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.</p>

    Args:
        locale: <p>A BCP 47 language tag or comma-separated priority list specifying the preferred locale for response content. See <code>Locale</code> for supported values, constraints, fallback behavior, and the default locale. If omitted, 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. Multiple filters are combined with AND logic. Multiple values within the same filter are combined with OR logic.</p>
        max_results: <p>The maximum number of results that are returned per call. You can use <code>nextToken</code> to get more results.</p>
        sort_by: <p>The field to sort results by. Valid values are <code>RELEVANCE</code> and <code>AVERAGE_CUSTOMER_RATING</code>.</p>
        sort_order: <p>The sort direction. Valid values are <code>DESCENDING</code> and <code>ASCENDING</code>.</p>
        next_token: <p>If <code>nextToken</code> is returned, there are more results available. Make the call again using the returned token to retrieve the next page.</p>

    Raises:
        capo_marketplace_discovery.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</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.</p>
        capo_marketplace_discovery.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service.</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 SaaS listings in the machine learning category with sorting by relevance

        >>> client.search_listings(locale='en-US', search_text='computer vision', filters=[{'filterType': 'CATEGORY', 'filterValues': ['machine-learning']}, {'filterType': 'FULFILLMENT_OPTION_TYPE', 'filterValues': ['SAAS']}], max_results=25, sort_by='RELEVANCE', sort_order='DESCENDING')
    """

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

        output, http_response = (
            capo_marketplace_discovery._operations.aws_marketplace_discovery.search_listings.search_listings(
                req.options, req.input
            )
        )
        return OperationResponse(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 = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output