Menu
AWS IoT
Developer Guide

UpdateThing

Updates the data for a thing.

Request syntax:

PATCH /things/thingName Content-type: application/json { "thingTypeName": "string", "attributePayload": { "attributes": { "string": "string" }, "merge": "boolean" }, "expectedVersion": "long", "removeThingType": "boolean" }

URI Request Parameters:

Name

Type

Req?

Description

thingName

ThingName

yes

The name of the thing to update.

Request Body Parameters:

Name

Type

Req?

Description

thingTypeName

ThingTypeName

no

The name of the thing type.

attributePayload

AttributePayload

no

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.

expectedVersion

OptionalVersion

no

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.

removeThingType

RemoveThingType

no

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

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

VersionConflictException

An exception thrown when the version of a thing passed to a command is different than the version specified with the --version parameter.

HTTP response code: 409

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

ResourceNotFoundException

The specified resource does not exist.

HTTP response code: 404

CLI

Synopsis:

aws iot update-thing \ --thing-name <value> \ [--thing-type-name <value>] \ [--attribute-payload <value>] \ [--expected-version <value>] \ [--remove-thing-type | --no-remove-thing-type] \ [--cli-input-json <value>] \ [--generate-cli-skeleton]

cli-input-json format:

{ "thingName": "string", "thingTypeName": "string", "attributePayload": { "attributes": { "string": "string" }, "merge": "boolean" }, "expectedVersion": "long", "removeThingType": "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 update.

thingTypeName

string

length max:128 min:1

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

The name of the thing type.

attributePayload

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

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.

expectedVersion

long

java class: java.lang.Long

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.

removeThingType

boolean

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

Output:

None

On this page: