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

******************
create_thing_group
******************



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

  

  Create a thing group.

   

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

     

    If the ``ThingGroup`` that you create has the exact same attributes as an existing ``ThingGroup``, you will get a 200 success response.

    

   

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


  **Request Syntax**
  ::

    response = client.create_thing_group(
        thingGroupName='string',
        parentGroupName='string',
        thingGroupProperties={
            'thingGroupDescription': 'string',
            'attributePayload': {
                'attributes': {
                    'string': 'string'
                },
                'merge': True|False
            }
        },
        tags=[
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    )
    
  :type thingGroupName: string
  :param thingGroupName: **[REQUIRED]** 

    The thing group name to create.

    

  
  :type parentGroupName: string
  :param parentGroupName: 

    The name of the parent thing group.

    

  
  :type thingGroupProperties: dict
  :param thingGroupProperties: 

    The thing group properties.

    

  
    - **thingGroupDescription** *(string) --* 

      The thing group description.

      

    
    - **attributePayload** *(dict) --* 

      The thing group attributes in JSON format.

      

    
      - **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 tags: list
  :param tags: 

    Metadata which can be used to manage the thing group.

    

  
    - *(dict) --* 

      A set of key/value pairs that are used to manage the resource.

      

    
      - **Key** *(string) --* **[REQUIRED]** 

        The tag's key.

        

      
      - **Value** *(string) --* 

        The tag's value.

        

      
    

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

    
    ::

      {
          'thingGroupName': 'string',
          'thingGroupArn': 'string',
          'thingGroupId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **thingGroupName** *(string) --* 

        The thing group name.

        
      

      - **thingGroupArn** *(string) --* 

        The thing group ARN.

        
      

      - **thingGroupId** *(string) --* 

        The thing group ID.

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

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

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

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

  