:doc:`IoT <../../iot>` / Client / create_thing

************
create_thing
************



.. py:method:: 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 <https://docs.aws.amazon.com/iot/latest/developerguide/iot-authorization.html>`__ for information about authorizing control plane actions.

    

   

  Requires permission to access the `CreateThing <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions>`__ action.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iot-2015-05-28/CreateThing>`_  


  **Request Syntax**
  ::

    response = client.create_thing(
        thingName='string',
        thingTypeName='string',
        attributePayload={
            'attributes': {
                'string': 'string'
            },
            'merge': True|False
        },
        billingGroupName='string'
    )
    
  :type thingName: string
  :param thingName: **[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.

    

  
  :type thingTypeName: string
  :param thingTypeName: 

    The name of the thing type associated with the new thing.

    

  
  :type attributePayload: dict
  :param attributePayload: 

    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``.

        

      

    
  
  :type billingGroupName: string
  :param billingGroupName: 

    The name of the billing group the thing will be added to.

    

  
  
  :rtype: 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**
  
  *   :py:class:`IoT.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`IoT.Client.exceptions.ThrottlingException`

  
  *   :py:class:`IoT.Client.exceptions.UnauthorizedException`

  
  *   :py:class:`IoT.Client.exceptions.ServiceUnavailableException`

  
  *   :py:class:`IoT.Client.exceptions.InternalFailureException`

  
  *   :py:class:`IoT.Client.exceptions.ResourceAlreadyExistsException`

  
  *   :py:class:`IoT.Client.exceptions.ResourceNotFoundException`

  