Menu
AWS IoT
Developer Guide

CreateThingGroup

Create a thing group.

Request syntax:

POST /thing-groups/thingGroupName Content-type: application/json { "parentGroupName": "string", "thingGroupProperties": { "thingGroupDescription": "string", "attributePayload": { "attributes": { "string": "string" }, "merge": "boolean" } } }

URI Request Parameters:

Name

Type

Req?

Description

thingGroupName

ThingGroupName

yes

The thing group name to create.

Request Body Parameters:

Name

Type

Req?

Description

parentGroupName

ThingGroupName

no

The name of the parent thing group.

thingGroupProperties

ThingGroupProperties

no

The thing group properties.

Response syntax:

Content-type: application/json { "thingGroupName": "string", "thingGroupArn": "string", "thingGroupId": "string" }

Response Body Parameters:

Name

Type

Req?

Description

thingGroupName

ThingGroupName

no

The thing group name.

thingGroupArn

ThingGroupArn

no

The thing group ARN.

thingGroupId

ThingGroupId

no

The thing group ID.

Errors:

InvalidRequestException

The contents of the request were invalid. For example, this code is returned when an UpdateJobExecution request contains invalid status details. The message contains details about the error.

HTTP response code: 400

ResourceAlreadyExistsException

The resource already exists.

HTTP response code: 409

ThrottlingException

The rate exceeds the limit.

HTTP response code: 429

InternalFailureException

An unexpected error has occurred.

HTTP response code: 500

CLI

Synopsis:

aws iot create-thing-group \ --thing-group-name <value> \ [--parent-group-name <value>] \ [--thing-group-properties <value>] \ [--cli-input-json <value>] \ [--generate-cli-skeleton]

cli-input-json format:

{ "thingGroupName": "string", "parentGroupName": "string", "thingGroupProperties": { "thingGroupDescription": "string", "attributePayload": { "attributes": { "string": "string" }, "merge": "boolean" } } }

cli-input-json fields:

Name

Type

Description

thingGroupName

string

length max:128 min:1

pattern: [a-zA-Z0-9:_-]+

The thing group name to create.

parentGroupName

string

length max:128 min:1

pattern: [a-zA-Z0-9:_-]+

The name of the parent thing group.

thingGroupProperties

ThingGroupProperties

The thing group properties.

thingGroupDescription

string

length max:2028

pattern: [\\p{Graph} ]*

The thing group description.

attributePayload

AttributePayload

The thing group attributes in JSON format.

attributes

map

key: AttributeName

value: AttributeValue

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

\"attributes\":{\"string1\":\"string2\"}

AttributeName

string

length max:128

pattern: [a-zA-Z0-9_.,@/:#-]+

AttributeValue

string

length max:800

pattern: [a-zA-Z0-9_.,@/:#-]*

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.

Output:

{ "thingGroupName": "string", "thingGroupArn": "string", "thingGroupId": "string" }

cli output fields:

Name

Type

Description

thingGroupName

string

length max:128 min:1

pattern: [a-zA-Z0-9:_-]+

The thing group name.

thingGroupArn

string

The thing group ARN.

thingGroupId

string

length max:128 min:1

pattern: [a-zA-Z0-9-]+

The thing group ID.

On this page: