getEntities method

Future<GetEntitiesResponse> getEntities({
  1. required List<String> ids,
  2. int? namespaceVersion,
})

Gets definitions of the specified entities. Uses the latest version of the user's namespace by default. This API returns the following TDM entities.

  • Properties
  • States
  • Events
  • Actions
  • Capabilities
  • Mappings
  • Devices
  • Device Models
  • Services
This action doesn't return definitions for systems, flows, and deployments.

May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw InternalFailureException.

Parameter ids : An array of entity IDs.

The IDs should be in the following format.

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

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

Implementation

Future<GetEntitiesResponse> getEntities({
  required List<String> ids,
  int? namespaceVersion,
}) async {
  ArgumentError.checkNotNull(ids, 'ids');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'IotThingsGraphFrontEndService.GetEntities'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ids': ids,
      if (namespaceVersion != null) 'namespaceVersion': namespaceVersion,
    },
  );

  return GetEntitiesResponse.fromJson(jsonResponse.body);
}