Table of Contents
A low-level client representing AWS IoT 1-Click Devices Service:
import boto3
client = boto3.client('iot1click-devices')
These are the available methods:
Check if an operation can be paginated.
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
response = client.claim_devices_by_claim_code(
ClaimCode='string'
)
[REQUIRED]
The claim code, starting with "C-", as provided by the device manufacturer.
{
'ClaimCode': 'string',
'Total': 123
}
Response Structure
200 response
The claim code provided by the device manufacturer.
The total number of devices associated with the claim code that has been processed in the claim request.
Given a device ID, returns a DescribeDeviceResponse object describing the details of the device.
See also: AWS API Documentation
Request Syntax
response = client.describe_device(
DeviceId='string'
)
[REQUIRED]
The unique identifier of the device.
{
'DeviceDescription': {
'Attributes': {
'string': 'string'
},
'DeviceId': 'string',
'Enabled': True|False,
'RemainingLife': 123.0,
'Type': 'string'
}
}
Response Structure
200 response
Device details.
An array of zero or more elements of DeviceAttribute objects providing user specified device attributes.
The unique identifier of the device.
A Boolean value indicating whether or not the device is enabled.
A value between 0 and 1 inclusive, representing the fraction of life remaining for the device.
The type of the device, such as "button".
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
response = client.finalize_device_claim(
DeviceId='string'
)
[REQUIRED]
The unique identifier of the device.
{
'State': 'string'
}
Response Structure
200 response
The device's final claim state.
Generate a presigned url given a client, its method, and arguments
The presigned url
Given a device ID, returns the invokable methods associated with the device.
See also: AWS API Documentation
Request Syntax
response = client.get_device_methods(
DeviceId='string'
)
[REQUIRED]
The unique identifier of the device.
{
'DeviceMethods': [
{
'DeviceType': 'string',
'MethodName': 'string'
},
]
}
Response Structure
200 response
List of available device APIs.
The type of the device, such as "button".
The name of the method applicable to the deviceType.
Create a paginator for an operation.
Returns an object that can wait for some condition.
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
response = client.initiate_device_claim(
DeviceId='string'
)
[REQUIRED]
The unique identifier of the device.
{
'State': 'string'
}
Response Structure
200 response
The device's final claim state.
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
response = client.invoke_device_method(
DeviceId='string',
DeviceMethod={
'DeviceType': 'string',
'MethodName': 'string'
},
DeviceMethodParameters='string'
)
[REQUIRED]
The unique identifier of the device.
The device method to invoke.
The type of the device, such as "button".
The name of the method applicable to the deviceType.
dict
Response Syntax
{
'DeviceMethodResponse': 'string'
}
Response Structure
(dict) --
200 response
DeviceMethodResponse (string) --
A JSON encoded string containing the device method response.
Using a device ID, returns a DeviceEventsResponse object containing an array of events for the device.
See also: AWS API Documentation
Request Syntax
response = client.list_device_events(
DeviceId='string',
FromTimeStamp=datetime(2015, 1, 1),
MaxResults=123,
NextToken='string',
ToTimeStamp=datetime(2015, 1, 1)
)
[REQUIRED]
The unique identifier of the device.
[REQUIRED]
The start date for the device event query, in ISO8061 format. For example, 2018-03-28T15:45:12.880Z
[REQUIRED]
The end date for the device event query, in ISO8061 format. For example, 2018-03-28T15:45:12.880Z
dict
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.
Lists the 1-Click compatible devices associated with your AWS account.
See also: AWS API Documentation
Request Syntax
response = client.list_devices(
DeviceType='string',
MaxResults=123,
NextToken='string'
)
dict
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.
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.
Disassociates a device from your AWS account using its device ID.
See also: AWS API Documentation
Request Syntax
response = client.unclaim_device(
DeviceId='string'
)
[REQUIRED]
The unique identifier of the device.
{
'State': 'string'
}
Response Structure
200 response
The device's final claim state.
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
response = client.update_device_state(
DeviceId='string',
Enabled=True|False
)
[REQUIRED]
The unique identifier of the device.
dict
Response Syntax
{}
Response Structure
(dict) --
200 response
The available paginators are:
paginator = client.get_paginator('list_device_events')
Creates an iterator that will paginate through responses from IoT1ClickDevicesService.Client.list_device_events().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
DeviceId='string',
FromTimeStamp=datetime(2015, 1, 1),
ToTimeStamp=datetime(2015, 1, 1),
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
[REQUIRED]
The unique identifier of the device.
[REQUIRED]
The start date for the device event query, in ISO8061 format. For example, 2018-03-28T15:45:12.880Z
[REQUIRED]
The end date for the device event query, in ISO8061 format. For example, 2018-03-28T15:45:12.880Z
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'Events': [
{
'Device': {
'Attributes': {},
'DeviceId': 'string',
'Type': 'string'
},
'StdEvent': '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.
paginator = client.get_paginator('list_devices')
Creates an iterator that will paginate through responses from IoT1ClickDevicesService.Client.list_devices().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
DeviceType='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'Devices': [
{
'Attributes': {
'string': 'string'
},
'DeviceId': 'string',
'Enabled': True|False,
'RemainingLife': 123.0,
'Type': '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.
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".