AWS IoT 1-Click Devices Service

2018/05/14 - AWS IoT 1-Click Devices Service - 10 new api methods

Changes  AWS IoT 1-Click makes it easy for customers to incorporate simple ready-to-use IoT devices into their workflows. These devices can trigger AWS Lambda functions that implement business logic. In order to build applications using AWS IoT 1-Click devices, programmers can use the AWS IoT 1-Click Devices API and the AWS IoT 1-Click Projects API. Learn more at https://aws.amazon.com/documentation/iot-1-click/

InitiateDeviceClaim (new) Link ¶

Given a device ID, initiates a claim request for the associated device.

Note

Claiming a device consists of initiating a claim, then publishing a device event, and finalizing the claim. For a device of type button, a device event can be published by simply clicking the device.

See also: AWS API Documentation

Request Syntax

client.initiate_device_claim(
    DeviceId='string'
)
type DeviceId

string

param DeviceId

[REQUIRED]

The unique identifier of the device.

rtype

dict

returns

Response Syntax

{
    'State': 'string'
}

Response Structure

  • (dict) --

    200 response

    • State (string) --

      The device's final claim state.

ClaimDevicesByClaimCode (new) Link ¶

Adds device(s) to your account (i.e., claim one or more devices) if and only if you received a claim code with the device(s).

See also: AWS API Documentation

Request Syntax

client.claim_devices_by_claim_code(
    ClaimCode='string'
)
type ClaimCode

string

param ClaimCode

[REQUIRED]

The claim code, starting with "C-", as provided by the device manufacturer.

rtype

dict

returns

Response Syntax

{
    'ClaimCode': 'string',
    'Total': 123
}

Response Structure

  • (dict) --

    200 response

    • ClaimCode (string) --

      The claim code provided by the device manufacturer.

    • Total (integer) --

      The total number of devices associated with the claim code that has been processed in the claim request.

ListDeviceEvents (new) Link ¶

Using a device ID, returns a DeviceEventsResponse object containing an array of events for the device.

See also: AWS API Documentation

Request Syntax

client.list_device_events(
    DeviceId='string',
    FromTimeStamp=datetime(2015, 1, 1),
    MaxResults=123,
    NextToken='string',
    ToTimeStamp=datetime(2015, 1, 1)
)
type DeviceId

string

param DeviceId

[REQUIRED]

The unique identifier of the device.

type FromTimeStamp

datetime

param FromTimeStamp

[REQUIRED]

The start date for the device event query, in ISO8061 format. For example, 2018-03-28T15:45:12.880Z

type MaxResults

integer

param MaxResults

The maximum number of results to return per request. If not set, a default value of 100 is used.

type NextToken

string

param NextToken

The token to retrieve the next set of results.

type ToTimeStamp

datetime

param ToTimeStamp

[REQUIRED]

The end date for the device event query, in ISO8061 format. For example, 2018-03-28T15:45:12.880Z

rtype

dict

returns

Response Syntax

{
    'Events': [
        {
            'Device': {
                'Attributes': {},
                'DeviceId': 'string',
                'Type': 'string'
            },
            'StdEvent': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    200 response

    • Events (list) --

      An array of zero or more elements describing the event(s) associated with the device.

      • (dict) --

        • Device (dict) --

          An object representing the device associated with the event.

          • Attributes (dict) --

            The user specified attributes associated with the device for an event.

          • DeviceId (string) --

            The unique identifier of the device.

          • Type (string) --

            The device type, such as "button".

        • StdEvent (string) --

          A serialized JSON object representing the device-type specific event.

    • NextToken (string) --

      The token to retrieve the next set of results.

FinalizeDeviceClaim (new) Link ¶

Given a device ID, finalizes the claim request for the associated device.

Note

Claiming a device consists of initiating a claim, then publishing a device event, and finalizing the claim. For a device of type button, a device event can be published by simply clicking the device.

See also: AWS API Documentation

Request Syntax

client.finalize_device_claim(
    DeviceId='string'
)
type DeviceId

string

param DeviceId

[REQUIRED]

The unique identifier of the device.

rtype

dict

returns

Response Syntax

{
    'State': 'string'
}

Response Structure

  • (dict) --

    200 response

    • State (string) --

      The device's final claim state.

GetDeviceMethods (new) Link ¶

Given a device ID, returns the invokable methods associated with the device.

See also: AWS API Documentation

Request Syntax

client.get_device_methods(
    DeviceId='string'
)
type DeviceId

string

param DeviceId

[REQUIRED]

The unique identifier of the device.

rtype

dict

returns

Response Syntax

{
    'DeviceMethods': [
        {
            'DeviceType': 'string',
            'MethodName': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    200 response

    • DeviceMethods (list) --

      List of available device APIs.

      • (dict) --

        • DeviceType (string) --

          The type of the device, such as "button".

        • MethodName (string) --

          The name of the method applicable to the deviceType.

InvokeDeviceMethod (new) Link ¶

Given a device ID, issues a request to invoke a named device method (with possible parameters). See the "Example POST" code snippet below.

See also: AWS API Documentation

Request Syntax

client.invoke_device_method(
    DeviceId='string',
    DeviceMethod={
        'DeviceType': 'string',
        'MethodName': 'string'
    },
    DeviceMethodParameters='string'
)
type DeviceId

string

param DeviceId

[REQUIRED]

The unique identifier of the device.

type DeviceMethod

dict

param DeviceMethod

The device method to invoke.

  • DeviceType (string) --

    The type of the device, such as "button".

  • MethodName (string) --

    The name of the method applicable to the deviceType.

type DeviceMethodParameters

string

param DeviceMethodParameters

A JSON encoded string containing the device method request parameters.

rtype

dict

returns

Response Syntax

{
    'DeviceMethodResponse': 'string'
}

Response Structure

  • (dict) --

    200 response

    • DeviceMethodResponse (string) --

      A JSON encoded string containing the device method response.

ListDevices (new) Link ¶

Lists the 1-Click compatible devices associated with your AWS account.

See also: AWS API Documentation

Request Syntax

client.list_devices(
    DeviceType='string',
    MaxResults=123,
    NextToken='string'
)
type DeviceType

string

param DeviceType

The type of the device, such as "button".

type MaxResults

integer

param MaxResults

The maximum number of results to return per request. If not set, a default value of 100 is used.

type NextToken

string

param NextToken

The token to retrieve the next set of results.

rtype

dict

returns

Response Syntax

{
    'Devices': [
        {
            'Attributes': {
                'string': 'string'
            },
            'DeviceId': 'string',
            'Enabled': True|False,
            'RemainingLife': 123.0,
            'Type': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    200 response

    • Devices (list) --

      A list of devices.

      • (dict) --

        • Attributes (dict) --

          An array of zero or more elements of DeviceAttribute objects providing user specified device attributes.

          • (string) --

            • (string) --

        • DeviceId (string) --

          The unique identifier of the device.

        • Enabled (boolean) --

          A Boolean value indicating whether or not the device is enabled.

        • RemainingLife (float) --

          A value between 0 and 1 inclusive, representing the fraction of life remaining for the device.

        • Type (string) --

          The type of the device, such as "button".

    • NextToken (string) --

      The token to retrieve the next set of results.

UpdateDeviceState (new) Link ¶

Using a Boolean value (true or false), this operation enables or disables the device given a device ID.

See also: AWS API Documentation

Request Syntax

client.update_device_state(
    DeviceId='string',
    Enabled=True|False
)
type DeviceId

string

param DeviceId

[REQUIRED]

The unique identifier of the device.

type Enabled

boolean

param Enabled

If true, the device is enabled. If false, the device is disabled.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

    200 response

UnclaimDevice (new) Link ¶

Disassociates a device from your AWS account using its device ID.

See also: AWS API Documentation

Request Syntax

client.unclaim_device(
    DeviceId='string'
)
type DeviceId

string

param DeviceId

[REQUIRED]

The unique identifier of the device.

rtype

dict

returns

Response Syntax

{
    'State': 'string'
}

Response Structure

  • (dict) --

    200 response

    • State (string) --

      The device's final claim state.

DescribeDevice (new) Link ¶

Given a device ID, returns a DescribeDeviceResponse object describing the details of the device.

See also: AWS API Documentation

Request Syntax

client.describe_device(
    DeviceId='string'
)
type DeviceId

string

param DeviceId

[REQUIRED]

The unique identifier of the device.

rtype

dict

returns

Response Syntax

{
    'DeviceDescription': {
        'Attributes': {
            'string': 'string'
        },
        'DeviceId': 'string',
        'Enabled': True|False,
        'RemainingLife': 123.0,
        'Type': 'string'
    }
}

Response Structure

  • (dict) --

    200 response

    • DeviceDescription (dict) --

      Device details.

      • Attributes (dict) --

        An array of zero or more elements of DeviceAttribute objects providing user specified device attributes.

        • (string) --

          • (string) --

      • DeviceId (string) --

        The unique identifier of the device.

      • Enabled (boolean) --

        A Boolean value indicating whether or not the device is enabled.

      • RemainingLife (float) --

        A value between 0 and 1 inclusive, representing the fraction of life remaining for the device.

      • Type (string) --

        The type of the device, such as "button".