- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
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
Parameter | Type | Description |
---|
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 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 |
---|
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 |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
InternalFailureException | server | |
InvalidRequestException | client | |
ThrottlingException | client | |
IoTThingsGraphServiceException | Base exception class for all service exceptions from IoTThingsGraph service. |