SearchEntitiesCommand

  • since: 2022-08-30

Searches for entities of the specified type. You can search for entities in your namespace and the public namespace that you're tracking.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { IoTThingsGraphClient, SearchEntitiesCommand } from "@aws-sdk/client-iotthingsgraph"; // ES Modules import
// const { IoTThingsGraphClient, SearchEntitiesCommand } = require("@aws-sdk/client-iotthingsgraph"); // CommonJS import
const client = new IoTThingsGraphClient(config);
const input = { // SearchEntitiesRequest
  entityTypes: [ // EntityTypes // required
    "DEVICE" || "SERVICE" || "DEVICE_MODEL" || "CAPABILITY" || "STATE" || "ACTION" || "EVENT" || "PROPERTY" || "MAPPING" || "ENUM",
  ],
  filters: [ // EntityFilters
    { // EntityFilter
      name: "NAME" || "NAMESPACE" || "SEMANTIC_TYPE_PATH" || "REFERENCED_ENTITY_ID",
      value: [ // EntityFilterValues
        "STRING_VALUE",
      ],
    },
  ],
  nextToken: "STRING_VALUE",
  maxResults: Number("int"),
  namespaceVersion: Number("long"),
};
const command = new SearchEntitiesCommand(input);
const response = await client.send(command);
// { // SearchEntitiesResponse
//   descriptions: [ // EntityDescriptions
//     { // EntityDescription
//       id: "STRING_VALUE",
//       arn: "STRING_VALUE",
//       type: "DEVICE" || "SERVICE" || "DEVICE_MODEL" || "CAPABILITY" || "STATE" || "ACTION" || "EVENT" || "PROPERTY" || "MAPPING" || "ENUM",
//       createdAt: new Date("TIMESTAMP"),
//       definition: { // DefinitionDocument
//         language: "GRAPHQL", // required
//         text: "STRING_VALUE", // required
//       },
//     },
//   ],
//   nextToken: "STRING_VALUE",
// };

SearchEntitiesCommand Input

See SearchEntitiesCommandInput for more details

Parameter
Type
Description
entityTypes
Required
EntityType[] | undefined

The entity types for which to search.

filters
EntityFilter[] | undefined

Optional filter to apply to the search. Valid filters are NAME NAMESPACE, SEMANTIC_TYPE_PATH and REFERENCED_ENTITY_ID. REFERENCED_ENTITY_ID filters on entities that are used by the entity in the result set. For example, you can filter on the ID of a property that is used in a state.

Multiple filters function as OR criteria in the query. Multiple values passed inside the filter function as AND criteria.

maxResults
number | undefined

The maximum number of results to return in the response.

namespaceVersion
number | undefined

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

nextToken
string | undefined

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

SearchEntitiesCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
descriptions
EntityDescription[] | undefined

An array of descriptions for each entity returned in the search result.

nextToken
string | undefined

The string to specify as nextToken when you request the next page of results.

Throws

Name
Fault
Details
InternalFailureException
server

InvalidRequestException
client

ThrottlingException
client

IoTThingsGraphServiceException
Base exception class for all service exceptions from IoTThingsGraph service.