SDK for PHP 3.x

Client: Aws\IotDataPlane\IotDataPlaneClient
Service ID: data.iot
Version: 2015-05-28

This page describes the parameters and results for the operations of the AWS IoT Data Plane (2015-05-28), and shows how to use the Aws\IotDataPlane\IotDataPlaneClient object to call the described operations. This documentation is specific to the 2015-05-28 API version of the service.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

DeleteThingShadow ( array $params = [] )
Deletes the shadow for the specified thing.
GetRetainedMessage ( array $params = [] )
Gets the details of a single retained message for the specified topic.
GetThingShadow ( array $params = [] )
Gets the shadow for the specified thing.
ListNamedShadowsForThing ( array $params = [] )
Lists the shadows for the specified thing.
ListRetainedMessages ( array $params = [] )
Lists summary information about the retained messages stored for the account.
Publish ( array $params = [] )
Publishes an MQTT message.
UpdateThingShadow ( array $params = [] )
Updates the shadow for the specified thing.

Paginators

Paginators handle automatically iterating over paginated API results. Paginators are associated with specific API operations, and they accept the parameters that the corresponding API operation accepts. You can get a paginator from a client class using getPaginator($paginatorName, $operationParameters). This client supports the following paginators:

ListRetainedMessages

Operations

DeleteThingShadow

$result = $client->deleteThingShadow([/* ... */]);
$promise = $client->deleteThingShadowAsync([/* ... */]);

Deletes the shadow for the specified thing.

Requires permission to access the DeleteThingShadow action.

For more information, see DeleteThingShadow in the IoT Developer Guide.

Parameter Syntax

$result = $client->deleteThingShadow([
    'shadowName' => '<string>',
    'thingName' => '<string>', // REQUIRED
]);

Parameter Details

Members
shadowName
Type: string

The name of the shadow.

thingName
Required: Yes
Type: string

The name of the thing.

Result Syntax

[
    'payload' => <string || resource || Psr\Http\Message\StreamInterface>,
]

Result Details

Members
payload
Required: Yes
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

The state information, in JSON format.

Errors

ResourceNotFoundException:

The specified resource does not exist.

InvalidRequestException:

The request is not valid.

ThrottlingException:

The rate exceeds the limit.

UnauthorizedException:

You are not authorized to perform this operation.

ServiceUnavailableException:

The service is temporarily unavailable.

InternalFailureException:

An unexpected error has occurred.

MethodNotAllowedException:

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

UnsupportedDocumentEncodingException:

The document encoding is not supported.

GetRetainedMessage

$result = $client->getRetainedMessage([/* ... */]);
$promise = $client->getRetainedMessageAsync([/* ... */]);

Gets the details of a single retained message for the specified topic.

This action returns the message payload of the retained message, which can incur messaging costs. To list only the topic names of the retained messages, call ListRetainedMessages.

Requires permission to access the GetRetainedMessage action.

For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.

Parameter Syntax

$result = $client->getRetainedMessage([
    'topic' => '<string>', // REQUIRED
]);

Parameter Details

Members
topic
Required: Yes
Type: string

The topic name of the retained message to retrieve.

Result Syntax

[
    'lastModifiedTime' => <integer>,
    'payload' => <string || resource || Psr\Http\Message\StreamInterface>,
    'qos' => <integer>,
    'topic' => '<string>',
    'userProperties' => <string || resource || Psr\Http\Message\StreamInterface>,
]

Result Details

Members
lastModifiedTime
Type: long (int|float)

The Epoch date and time, in milliseconds, when the retained message was stored by IoT.

payload
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

The Base64-encoded message payload of the retained message body.

qos
Type: int

The quality of service (QoS) level used to publish the retained message.

topic
Type: string

The topic name to which the retained message was published.

userProperties
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

A base64-encoded JSON string that includes an array of JSON objects, or null if the retained message doesn't include any user properties.

The following example userProperties parameter is a JSON string that represents two user properties. Note that it will be base64-encoded:

[{"deviceName": "alpha"}, {"deviceCnt": "45"}]

Errors

InvalidRequestException:

The request is not valid.

ResourceNotFoundException:

The specified resource does not exist.

ThrottlingException:

The rate exceeds the limit.

UnauthorizedException:

You are not authorized to perform this operation.

ServiceUnavailableException:

The service is temporarily unavailable.

InternalFailureException:

An unexpected error has occurred.

MethodNotAllowedException:

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

GetThingShadow

$result = $client->getThingShadow([/* ... */]);
$promise = $client->getThingShadowAsync([/* ... */]);

Gets the shadow for the specified thing.

Requires permission to access the GetThingShadow action.

For more information, see GetThingShadow in the IoT Developer Guide.

Parameter Syntax

$result = $client->getThingShadow([
    'shadowName' => '<string>',
    'thingName' => '<string>', // REQUIRED
]);

Parameter Details

Members
shadowName
Type: string

The name of the shadow.

thingName
Required: Yes
Type: string

The name of the thing.

Result Syntax

[
    'payload' => <string || resource || Psr\Http\Message\StreamInterface>,
]

Result Details

Members
payload
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

The state information, in JSON format.

Errors

InvalidRequestException:

The request is not valid.

ResourceNotFoundException:

The specified resource does not exist.

ThrottlingException:

The rate exceeds the limit.

UnauthorizedException:

You are not authorized to perform this operation.

ServiceUnavailableException:

The service is temporarily unavailable.

InternalFailureException:

An unexpected error has occurred.

MethodNotAllowedException:

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

UnsupportedDocumentEncodingException:

The document encoding is not supported.

ListNamedShadowsForThing

$result = $client->listNamedShadowsForThing([/* ... */]);
$promise = $client->listNamedShadowsForThingAsync([/* ... */]);

Lists the shadows for the specified thing.

Requires permission to access the ListNamedShadowsForThing action.

Parameter Syntax

$result = $client->listNamedShadowsForThing([
    'nextToken' => '<string>',
    'pageSize' => <integer>,
    'thingName' => '<string>', // REQUIRED
]);

Parameter Details

Members
nextToken
Type: string

The token to retrieve the next set of results.

pageSize
Type: int

The result page size.

thingName
Required: Yes
Type: string

The name of the thing.

Result Syntax

[
    'nextToken' => '<string>',
    'results' => ['<string>', ...],
    'timestamp' => <integer>,
]

Result Details

Members
nextToken
Type: string

The token to use to get the next set of results, or null if there are no additional results.

results
Type: Array of strings

The list of shadows for the specified thing.

timestamp
Type: long (int|float)

The Epoch date and time the response was generated by IoT.

Errors

ResourceNotFoundException:

The specified resource does not exist.

InvalidRequestException:

The request is not valid.

ThrottlingException:

The rate exceeds the limit.

UnauthorizedException:

You are not authorized to perform this operation.

ServiceUnavailableException:

The service is temporarily unavailable.

InternalFailureException:

An unexpected error has occurred.

MethodNotAllowedException:

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

ListRetainedMessages

$result = $client->listRetainedMessages([/* ... */]);
$promise = $client->listRetainedMessagesAsync([/* ... */]);

Lists summary information about the retained messages stored for the account.

This action returns only the topic names of the retained messages. It doesn't return any message payloads. Although this action doesn't return a message payload, it can still incur messaging costs.

To get the message payload of a retained message, call GetRetainedMessage with the topic name of the retained message.

Requires permission to access the ListRetainedMessages action.

For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.

Parameter Syntax

$result = $client->listRetainedMessages([
    'maxResults' => <integer>,
    'nextToken' => '<string>',
]);

Parameter Details

Members
maxResults
Type: int

The maximum number of results to return at one time.

nextToken
Type: string

To retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.

Result Syntax

[
    'nextToken' => '<string>',
    'retainedTopics' => [
        [
            'lastModifiedTime' => <integer>,
            'payloadSize' => <integer>,
            'qos' => <integer>,
            'topic' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
nextToken
Type: string

The token for the next set of results, or null if there are no additional results.

retainedTopics
Type: Array of RetainedMessageSummary structures

A summary list the account's retained messages. The information returned doesn't include the message payloads of the retained messages.

Errors

InvalidRequestException:

The request is not valid.

ThrottlingException:

The rate exceeds the limit.

UnauthorizedException:

You are not authorized to perform this operation.

ServiceUnavailableException:

The service is temporarily unavailable.

InternalFailureException:

An unexpected error has occurred.

MethodNotAllowedException:

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

Publish

$result = $client->publish([/* ... */]);
$promise = $client->publishAsync([/* ... */]);

Publishes an MQTT message.

Requires permission to access the Publish action.

For more information about MQTT messages, see MQTT Protocol in the IoT Developer Guide.

For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.

Parameter Syntax

$result = $client->publish([
    'contentType' => '<string>',
    'correlationData' => '<string>',
    'messageExpiry' => <integer>,
    'payload' => <string || resource || Psr\Http\Message\StreamInterface>,
    'payloadFormatIndicator' => 'UNSPECIFIED_BYTES|UTF8_DATA',
    'qos' => <integer>,
    'responseTopic' => '<string>',
    'retain' => true || false,
    'topic' => '<string>', // REQUIRED
    'userProperties' => '<string>',
]);

Parameter Details

Members
contentType
Type: string

A UTF-8 encoded string that describes the content of the publishing message.

correlationData
Type: string

The base64-encoded binary data used by the sender of the request message to identify which request the response message is for when it's received. correlationData is an HTTP header value in the API.

messageExpiry
Type: long (int|float)

A user-defined integer value that represents the message expiry interval in seconds. If absent, the message doesn't expire. For more information about the limits of messageExpiry, see Amazon Web Services IoT Core message broker and protocol limits and quotas from the Amazon Web Services Reference Guide.

payload
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

The message body. MQTT accepts text, binary, and empty (null) message payloads.

Publishing an empty (null) payload with retain = true deletes the retained message identified by topic from Amazon Web Services IoT Core.

payloadFormatIndicator
Type: string

An Enum string value that indicates whether the payload is formatted as UTF-8. payloadFormatIndicator is an HTTP header value in the API.

qos
Type: int

The Quality of Service (QoS) level. The default QoS level is 0.

responseTopic
Type: string

A UTF-8 encoded string that's used as the topic name for a response message. The response topic is used to describe the topic which the receiver should publish to as part of the request-response flow. The topic must not contain wildcard characters.

retain
Type: boolean

A Boolean value that determines whether to set the RETAIN flag when the message is published.

Setting the RETAIN flag causes the message to be retained and sent to new subscribers to the topic.

Valid values: true | false

Default value: false

topic
Required: Yes
Type: string

The name of the MQTT topic.

userProperties
Type: string (string|number|array|map or anything parsable by json_encode)

A JSON string that contains an array of JSON objects. If you don’t use Amazon Web Services SDK or CLI, you must encode the JSON string to base64 format before adding it to the HTTP header. userProperties is an HTTP header value in the API.

The following example userProperties parameter is a JSON string which represents two User Properties. Note that it needs to be base64-encoded:

[{"deviceName": "alpha"}, {"deviceCnt": "45"}]

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InternalFailureException:

An unexpected error has occurred.

InvalidRequestException:

The request is not valid.

UnauthorizedException:

You are not authorized to perform this operation.

MethodNotAllowedException:

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

ThrottlingException:

The rate exceeds the limit.

UpdateThingShadow

$result = $client->updateThingShadow([/* ... */]);
$promise = $client->updateThingShadowAsync([/* ... */]);

Updates the shadow for the specified thing.

Requires permission to access the UpdateThingShadow action.

For more information, see UpdateThingShadow in the IoT Developer Guide.

Parameter Syntax

$result = $client->updateThingShadow([
    'payload' => <string || resource || Psr\Http\Message\StreamInterface>, // REQUIRED
    'shadowName' => '<string>',
    'thingName' => '<string>', // REQUIRED
]);

Parameter Details

Members
payload
Required: Yes
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

The state information, in JSON format.

shadowName
Type: string

The name of the shadow.

thingName
Required: Yes
Type: string

The name of the thing.

Result Syntax

[
    'payload' => <string || resource || Psr\Http\Message\StreamInterface>,
]

Result Details

Members
payload
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

The state information, in JSON format.

Errors

ConflictException:

The specified version does not match the version of the document.

RequestEntityTooLargeException:

The payload exceeds the maximum size allowed.

InvalidRequestException:

The request is not valid.

ThrottlingException:

The rate exceeds the limit.

UnauthorizedException:

You are not authorized to perform this operation.

ServiceUnavailableException:

The service is temporarily unavailable.

InternalFailureException:

An unexpected error has occurred.

MethodNotAllowedException:

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

UnsupportedDocumentEncodingException:

The document encoding is not supported.

Shapes

ConflictException

Description

The specified version does not match the version of the document.

Members
message
Type: string

The message for the exception.

InternalFailureException

Description

An unexpected error has occurred.

Members
message
Type: string

The message for the exception.

InvalidRequestException

Description

The request is not valid.

Members
message
Type: string

The message for the exception.

MethodNotAllowedException

Description

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

Members
message
Type: string

The message for the exception.

RequestEntityTooLargeException

Description

The payload exceeds the maximum size allowed.

Members
message
Type: string

The message for the exception.

ResourceNotFoundException

Description

The specified resource does not exist.

Members
message
Type: string

The message for the exception.

RetainedMessageSummary

Description

Information about a single retained message.

Members
lastModifiedTime
Type: long (int|float)

The Epoch date and time, in milliseconds, when the retained message was stored by IoT.

payloadSize
Type: long (int|float)

The size of the retained message's payload in bytes.

qos
Type: int

The quality of service (QoS) level used to publish the retained message.

topic
Type: string

The topic name to which the retained message was published.

ServiceUnavailableException

Description

The service is temporarily unavailable.

Members
message
Type: string

The message for the exception.

ThrottlingException

Description

The rate exceeds the limit.

Members
message
Type: string

The message for the exception.

UnauthorizedException

Description

You are not authorized to perform this operation.

Members
message
Type: string

The message for the exception.

UnsupportedDocumentEncodingException

Description

The document encoding is not supported.

Members
message
Type: string

The message for the exception.