create_thing

IoT.Client.create_thing(**kwargs)

Creates a thing record in the registry. If this call is made multiple times using the same thing name and configuration, the call will succeed. If this call is made with the same thing name but different configuration a ResourceAlreadyExistsException is thrown.

Note

This is a control plane operation. See Authorization for information about authorizing control plane actions.

Requires permission to access the CreateThing action.

See also: AWS API Documentation

Request Syntax

response = client.create_thing(
    thingName='string',
    thingTypeName='string',
    attributePayload={
        'attributes': {
            'string': 'string'
        },
        'merge': True|False
    },
    billingGroupName='string'
)
Parameters
  • thingName (string) --

    [REQUIRED]

    The name of the thing to create.

    You can't change a thing's name after you create it. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.

  • thingTypeName (string) -- The name of the thing type associated with the new thing.
  • attributePayload (dict) --

    The attribute payload, which consists of up to three name/value pairs in a JSON document. For example:

    {\"attributes\":{\"string1\":\"string2\"}}
    • attributes (dict) --

      A JSON string containing up to three key-value pair in JSON format. For example:

      {\"attributes\":{\"string1\":\"string2\"}}
      • (string) --
        • (string) --
    • merge (boolean) --

      Specifies whether the list of attributes provided in the AttributePayload is merged with the attributes stored in the registry, instead of overwriting them.

      To remove an attribute, call UpdateThing with an empty attribute value.

      Note

      The merge attribute is only valid when calling UpdateThing or UpdateThingGroup .

  • billingGroupName (string) -- The name of the billing group the thing will be added to.
Return type

dict

Returns

Response Syntax

{
    'thingName': 'string',
    'thingArn': 'string',
    'thingId': 'string'
}

Response Structure

  • (dict) --

    The output of the CreateThing operation.

    • thingName (string) --

      The name of the new thing.

    • thingArn (string) --

      The ARN of the new thing.

    • thingId (string) --

      The thing ID.

Exceptions

  • IoT.Client.exceptions.InvalidRequestException
  • IoT.Client.exceptions.ThrottlingException
  • IoT.Client.exceptions.UnauthorizedException
  • IoT.Client.exceptions.ServiceUnavailableException
  • IoT.Client.exceptions.InternalFailureException
  • IoT.Client.exceptions.ResourceAlreadyExistsException
  • IoT.Client.exceptions.ResourceNotFoundException