registerThing method

Future<RegisterThingResponse> registerThing({
  1. required String templateBody,
  2. Map<String, String>? parameters,
})

Provisions a thing in the device registry. RegisterThing calls other AWS IoT control plane APIs. These calls might exceed your account level AWS IoT Throttling Limits and cause throttle errors. Please contact AWS Customer Support to raise your throttling limits if necessary.

May throw InternalFailureException. May throw ServiceUnavailableException. May throw InvalidRequestException. May throw UnauthorizedException. May throw ThrottlingException. May throw ConflictingResourceUpdateException. May throw ResourceRegistrationFailureException.

Parameter templateBody : The provisioning template. See Provisioning Devices That Have Device Certificates for more information.

Parameter parameters : The parameters for provisioning a thing. See Provisioning Templates for more information.

Implementation

Future<RegisterThingResponse> registerThing({
  required String templateBody,
  Map<String, String>? parameters,
}) async {
  ArgumentError.checkNotNull(templateBody, 'templateBody');
  final $payload = <String, dynamic>{
    'templateBody': templateBody,
    if (parameters != null) 'parameters': parameters,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/things',
    exceptionFnMap: _exceptionFns,
  );
  return RegisterThingResponse.fromJson(response);
}