Skip to content

list_things

list_things(
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[RegistryMaxResults] = None,
    attribute_name: Optional[AttributeName] = None,
    attribute_value: Optional[AttributeValue] = None,
    thing_type_name: Optional[ThingTypeName] = None,
    use_prefix_attribute_value: Optional[usePrefixAttributeValue] = None,
) -> ListThingsResponse

Lists your things. Use the attributeName and attributeValue parameters to filter your things. For example, calling ListThings with attributeName=Color and attributeValue=Red retrieves all things in the registry that contain an attribute Color with the value Red. For more information, see List Things from the Amazon Web Services IoT Core Developer Guide.

Requires permission to access the ListThings action.

You will not be charged for calling this API if an Access denied error is returned. You will also not be charged if no attributes or pagination token was provided in request and no pagination token and no results were returned.

Parameters:

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

    To retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.

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

    The maximum number of results to return in this operation.

  • attribute_name (Optional[AttributeName], default: None ) –

    The attribute name used to search for things.

  • attribute_value (Optional[AttributeValue], default: None ) –

    The attribute value used to search for things.

  • thing_type_name (Optional[ThingTypeName], default: None ) –

    The name of the thing type used to search for things.

  • use_prefix_attribute_value (Optional[usePrefixAttributeValue], default: None ) –

    When true, the action returns the thing resources with attribute values that start with the attributeValue provided.

    When false, or not present, the action returns only the thing resources with attribute values that match the entire attributeValue provided.

Raises:

Source code in docs_src/capo_iot/_services/io_t.py
def list_things(
    self,
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    next_token: Optional["capo_iot.types.next_token.NextToken"] = None,
    max_results: Optional[
        "capo_iot.types.registry_max_results.RegistryMaxResults"
    ] = None,
    attribute_name: Optional["capo_iot.types.attribute_name.AttributeName"] = None,
    attribute_value: Optional[
        "capo_iot.types.attribute_value.AttributeValue"
    ] = None,
    thing_type_name: Optional[
        "capo_iot.types.thing_type_name.ThingTypeName"
    ] = None,
    use_prefix_attribute_value: Optional[
        "capo_iot.types.use_prefix_attribute_value.usePrefixAttributeValue"
    ] = None,
) -> "capo_iot.types.list_things_response.ListThingsResponse":
    """<p>Lists your things. Use the <b>attributeName</b> and <b>attributeValue</b> parameters to filter your things. For example, calling <code>ListThings</code> with attributeName=Color and attributeValue=Red retrieves all things in the registry that contain an attribute <b>Color</b> with the value <b>Red</b>. For more information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html#list-things">List Things</a> from the <i>Amazon Web Services IoT Core Developer Guide</i>.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">ListThings</a> action.</p> <note> <p>You will not be charged for calling this API if an <code>Access denied</code> error is returned. You will also not be charged if no attributes or pagination token was provided in request and no pagination token and no results were returned.</p> </note>

    Args:
        next_token: <p>To retrieve the next set of results, the <code>nextToken</code> value from a previous response; otherwise <b>null</b> to receive the first set of results.</p>
        max_results: <p>The maximum number of results to return in this operation.</p>
        attribute_name: <p>The attribute name used to search for things.</p>
        attribute_value: <p>The attribute value used to search for things.</p>
        thing_type_name: <p>The name of the thing type used to search for things.</p>
        use_prefix_attribute_value: <p>When <code>true</code>, the action returns the thing resources with attribute values that start with the <code>attributeValue</code> provided.</p> <p>When <code>false</code>, or not present, the action returns only the thing resources with attribute values that match the entire <code>attributeValue</code> provided. </p>

    Raises:
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iot.types.list_things_request.ListThingsRequest]",
    ) -> OperationResponse[
        "capo_iot.types.list_things_response.ListThingsResponse"
    ]:
        import capo_iot._operations.aws_iot_service.list_things

        output, http_response = (
            capo_iot._operations.aws_iot_service.list_things.list_things(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListThings")
    )
    input_: capo_iot.types.list_things_request.ListThingsRequest = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if attribute_name is not None:
        input_["attribute_name"] = attribute_name
    if attribute_value is not None:
        input_["attribute_value"] = attribute_value
    if thing_type_name is not None:
        input_["thing_type_name"] = thing_type_name
    if use_prefix_attribute_value is not None:
        input_["use_prefix_attribute_value"] = use_prefix_attribute_value

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output