Menu
AWS IoT
Developer Guide

CreateThing

Creates a thing record in the registry.

Request syntax:

POST /things/thingName Content-type: application/json { "thingTypeName": "string", "attributePayload": { "attributes": { "string": "string" }, "merge": "boolean" } }

URI Request Parameters:

Name

Type

Req?

Description

thingName

ThingName

yes

The name of the thing to create.

Request Body Parameters:

Name

Type

Req?

Description

thingTypeName

ThingTypeName

no

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

attributePayload

AttributePayload

no

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

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

Response syntax:

Content-type: application/json { "thingName": "string", "thingArn": "string", "thingId": "string" }

Response Body Parameters:

Name

Type

Req?

Description

thingName

ThingName

no

The name of the new thing.

thingArn

ThingArn

no

The ARN of the new thing.

thingId

ThingId

no

The thing 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

ThrottlingException

The rate exceeds the limit.

HTTP response code: 429

UnauthorizedException

You are not authorized to perform this operation.

HTTP response code: 401

ServiceUnavailableException

The service is temporarily unavailable.

HTTP response code: 503

InternalFailureException

An unexpected error has occurred.

HTTP response code: 500

ResourceAlreadyExistsException

The resource already exists.

HTTP response code: 409

ResourceNotFoundException

The specified resource does not exist.

HTTP response code: 404

CLI

Synopsis:

aws iot create-thing \ --thing-name <value> \ [--thing-type-name <value>] \ [--attribute-payload <value>] \ [--cli-input-json <value>] \ [--generate-cli-skeleton]

cli-input-json format:

{ "thingName": "string", "thingTypeName": "string", "attributePayload": { "attributes": { "string": "string" }, "merge": "boolean" } }

cli-input-json fields:

Name

Type

Description

thingName

string

length max:128 min:1

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

The name of the thing to create.

thingTypeName

string

length max:128 min:1

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

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

attributePayload

AttributePayload

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

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

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:

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

cli output fields:

Name

Type

Description

thingName

string

length max:128 min:1

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

The name of the new thing.

thingArn

string

The ARN of the new thing.

thingId

string

The thing ID.

On this page: