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

************
update_thing
************



.. py:method:: IoT.Client.update_thing(**kwargs)

  

  Updates the data for a thing.

   

  Requires permission to access the `UpdateThing <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/UpdateThing>`_  


  **Request Syntax**
  ::

    response = client.update_thing(
        thingName='string',
        thingTypeName='string',
        attributePayload={
            'attributes': {
                'string': 'string'
            },
            'merge': True|False
        },
        expectedVersion=123,
        removeThingType=True|False
    )
    
  :type thingName: string
  :param thingName: **[REQUIRED]** 

    The name of the thing to update.

     

    You can't change a thing's name. 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.

    

  
  :type attributePayload: dict
  :param attributePayload: 

    A list of thing attributes, a JSON string containing name-value pairs. For example:

     

    ``{\"attributes\":{\"name1\":\"value2\"}}``

     

    This data is used to add new attributes or update existing attributes.

    

  
    - **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 expectedVersion: integer
  :param expectedVersion: 

    The expected version of the thing record in the registry. If the version of the record in the registry does not match the expected version specified in the request, the ``UpdateThing`` request is rejected with a ``VersionConflictException``.

    

  
  :type removeThingType: boolean
  :param removeThingType: 

    Remove a thing type association. If **true**, the association is removed.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {}
      
    **Response Structure**

    

    - *(dict) --* 

      The output from the UpdateThing operation.

      
  
  **Exceptions**
  
  *   :py:class:`IoT.Client.exceptions.InvalidRequestException`

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

  
  *   :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.ResourceNotFoundException`

  