Menu
AWS IoT
Developer Guide

Publish

Publishes state information.

For more information, see HTTP Protocol in the AWS IoT Developer Guide.

Request syntax:

POST /topics/topic?qos=qos Content-type: application/json { "payload": "blob" }

URI Request Parameters:

Name

Type

Req?

Description

topic

Topic

no

The name of the MQTT topic.

qos

Qos

no

The Quality of Service (QoS) level.

Request Body Parameters:

Name

Type

Req?

Description

payload

Payload

no

The state information, in JSON format.

Errors:

InternalFailureException

An unexpected error has occurred.

HTTP response code: 500

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

UnauthorizedException

You are not authorized to perform this operation.

HTTP response code: 401

MethodNotAllowedException

The specified combination of HTTP verb and URI is not supported.

HTTP response code: 405

CLI

Synopsis:

aws iot-data publish \ [--topic <value>] \ [--qos <value>] \ [--payload <value>] \ [--cli-input-json <value>] \ [--generate-cli-skeleton]

cli-input-json format:

{ "topic": "string", "qos": "integer", "payload": "blob" }

cli-input-json fields:

Name

Type

Description

topic

string

The name of the MQTT topic.

qos

integer

range- max:1 min:0

The Quality of Service (QoS) level.

payload

blob

The state information, in JSON format.

Output:

None

On this page: