Skip to content

search_things

search_things(
    entity_id: Urn,
    *,
    config_overrides: Optional[IoTThingsGraphClientConfig] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
    namespace_version: Optional[Version] = None,
) -> SearchThingsResponse

Searches for things associated with the specified entity. You can search by both device and device model.

For example, if two different devices, camera1 and camera2, implement the camera device model, the user can associate thing1 to camera1 and thing2 to camera2. SearchThings(camera2) will return only thing2, but SearchThings(camera) will return both thing1 and thing2.

This action searches for exact matches and doesn't perform partial text matching.

Parameters:

  • entity_id (Urn) –

    The ID of the entity to which the things are associated.

    The IDs should be in the following format.

    urn:tdm:REGION/ACCOUNT ID/default:device:DEVICENAME

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

    The string that specifies the next page of results. Use this when you're paginating results.

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

    The maximum number of results to return in the response.

  • namespace_version (Optional[Version], default: None ) –

    The version of the user's namespace. Defaults to the latest version of the user's namespace.

Raises:

Source code in docs_src/capo_iotthingsgraph/_services/io_t_things_graph.py
def search_things(
    self,
    entity_id: "capo_iotthingsgraph.types.urn.Urn",
    *,
    config_overrides: Optional[IoTThingsGraphClientConfig] = None,
    next_token: Optional["capo_iotthingsgraph.types.next_token.NextToken"] = None,
    max_results: Optional[
        "capo_iotthingsgraph.types.max_results.MaxResults"
    ] = None,
    namespace_version: Optional["capo_iotthingsgraph.types.version.Version"] = None,
) -> "capo_iotthingsgraph.types.search_things_response.SearchThingsResponse":
    """<p>Searches for things associated with the specified entity. You can search by both device and device model.</p> <p>For example, if two different devices, camera1 and camera2, implement the camera device model, the user can associate thing1 to camera1 and thing2 to camera2. <code>SearchThings(camera2)</code> will return only thing2, but <code>SearchThings(camera)</code> will return both thing1 and thing2.</p> <p>This action searches for exact matches and doesn't perform partial text matching.</p>

    Args:
        entity_id: <p>The ID of the entity to which the things are associated.</p> <p>The IDs should be in the following format.</p> <p> <code>urn:tdm:REGION/ACCOUNT ID/default:device:DEVICENAME</code> </p>
        next_token: <p>The string that specifies the next page of results. Use this when you're paginating results.</p>
        max_results: <p>The maximum number of results to return in the response.</p>
        namespace_version: <p>The version of the user's namespace. Defaults to the latest version of the user's namespace.</p>

    Raises:
        capo_iotthingsgraph.errors.internal_failure_exception.InternalFailureException: <p></p>
        capo_iotthingsgraph.errors.invalid_request_exception.InvalidRequestException: <p></p>
        capo_iotthingsgraph.errors.resource_not_found_exception.ResourceNotFoundException: <p></p>
        capo_iotthingsgraph.errors.throttling_exception.ThrottlingException: <p></p>
        capo_iotthingsgraph.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iotthingsgraph.types.search_things_request.SearchThingsRequest]",
    ) -> OperationResponse[
        "capo_iotthingsgraph.types.search_things_response.SearchThingsResponse"
    ]:
        import capo_iotthingsgraph._operations.iot_things_graph_front_end_service.search_things

        output, http_response = (
            capo_iotthingsgraph._operations.iot_things_graph_front_end_service.search_things.search_things(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SearchThings")
    )
    input_: capo_iotthingsgraph.types.search_things_request.SearchThingsRequest = {
        "entity_id": entity_id
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if namespace_version is not None:
        input_["namespace_version"] = namespace_version

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