Details on the various actions that can be performed on the
Device resource, including the expected
parameters and the potential responses.
Deletes a device
result = client.device.delete(
applicationId: my_application_id,
deviceId: my_device_id)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Organization, all.User, device.*, or device.delete.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
200 |
Success |
If device was successfully deleted |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |
Creates a device data export. Defaults to all data.
result = client.device.export(
applicationId: my_application_id,
deviceId: my_device_id)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.export.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
start |
string |
N |
Start time of export (ms since epoch - 0 means now, negative is relative to now) |
1 |
1465790400000 |
end |
string |
N |
End time of export (ms since epoch - 0 means now, negative is relative to now) |
0 |
1465790400000 |
email |
string |
N |
Email address to send export to. Defaults to current user's email. |
|
[email protected] |
callbackUrl |
string |
N |
Callback URL to call with export result |
|
https://example.com/cburl |
includeBlobData |
string |
N |
If set will export any blob attributes in base64 form, otherwise they will be downloadable links which will expire. |
|
true |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |
Retrieves information on a device
result = client.device.get(
applicationId: my_application_id,
deviceId: my_device_id)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.get.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
excludeConnectionInfo |
string |
N |
If set, do not return connection info |
|
true |
tagsAsObject |
string |
N |
Return tags as an object map instead of an array |
|
true |
attributesAsObject |
string |
N |
Return attributes as an object map instead of an array |
|
false |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
200 |
Device |
Device information |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |
Retrieve the last known commands(s) sent to the device
result = client.device.get_command(
applicationId: my_application_id,
deviceId: my_device_id)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.getCommand.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
limit |
string |
N |
Maximum number of command entries to return |
1 |
10 |
since |
string |
N |
(deprecated) Look for command entries since this time (ms since epoch) |
|
1465790400000 |
sortDirection |
string |
N |
Direction to sort the command entries (by time). Accepted values are: asc, desc |
desc |
desc |
duration |
string |
N |
Duration of time range to query in milliseconds |
|
86400000 |
start |
string |
N |
Start of time range to query in milliseconds since epoch |
|
1465790400000 |
end |
string |
N |
End of time range to query in milliseconds since epoch |
|
0 |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |
Retrieve the composite last complete state of the device
result = client.device.get_composite_state(
applicationId: my_application_id,
deviceId: my_device_id)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.getCompositeState.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
start |
string |
N |
Start of time range to look at to build composite state |
1 |
1465790400000 |
end |
string |
N |
End of time range to look at to build composite state |
0 |
1465790400000 |
attributes |
string |
N |
Comma-separated list of attributes to include. When not provided, returns all attributes. |
|
myAttr1,myAttr2 |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |
Retrieve the recent log entries about the device
result = client.device.get_log_entries(
applicationId: my_application_id,
deviceId: my_device_id)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.getLogEntries.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
limit |
string |
N |
Maximum number of log entries to return |
1 |
10 |
since |
string |
N |
(deprecated) Look for log entries since this time (ms since epoch) |
|
1465790400000 |
sortDirection |
string |
N |
Direction to sort the log entries (by time). Accepted values are: asc, desc |
desc |
desc |
duration |
string |
N |
Duration of time range to query in milliseconds |
|
86400000 |
start |
string |
N |
Start of time range to query in milliseconds since epoch |
|
1465790400000 |
end |
string |
N |
End of time range to query in milliseconds since epoch |
|
0 |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
200 |
Device Log |
Recent log entries |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |
Retrieve the last known state(s) of the device
result = client.device.get_state(
applicationId: my_application_id,
deviceId: my_device_id)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Application.read, all.Device, all.Device.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.getState.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
limit |
string |
N |
Maximum number of state entries to return |
1 |
10 |
since |
string |
N |
(deprecated) Look for state entries since this time (ms since epoch) |
|
1465790400000 |
sortDirection |
string |
N |
Direction to sort the state entries (by time). Accepted values are: asc, desc |
desc |
desc |
duration |
string |
N |
Duration of time range to query in milliseconds |
|
86400000 |
start |
string |
N |
Start of time range to query in milliseconds since epoch |
|
1465790400000 |
end |
string |
N |
End of time range to query in milliseconds since epoch |
|
0 |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |
Updates information about a device
result = client.device.patch(
applicationId: my_application_id,
deviceId: my_device_id,
device: my_device)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Organization, all.User, device.*, or device.patch.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
device |
Device Patch |
Y |
Object containing new properties of the device |
|
Device Patch Example |
tagsAsObject |
string |
N |
Return tags as an object map instead of an array |
|
true |
attributesAsObject |
string |
N |
Return attributes as an object map instead of an array |
|
false |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
200 |
Device |
Updated device information |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |
Returns payload counts for the time range specified for this device
result = client.device.payload_counts(
applicationId: my_application_id,
deviceId: my_device_id)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.payloadCounts.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
start |
string |
N |
Start of range for payload count query (ms since epoch) |
-2592000000 |
0 |
end |
string |
N |
End of range for payload count query (ms since epoch) |
0 |
1465790400000 |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |
Returns payload counts per resolution in the time range specified for this device
result = client.device.payload_counts_breakdown(
applicationId: my_application_id,
deviceId: my_device_id)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, device.*, or device.payloadCountsBreakdown.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
start |
string |
N |
Start of range for payload count query (ms since epoch) |
-2592000000 |
0 |
end |
string |
N |
End of range for payload count query (ms since epoch) |
0 |
1465790400000 |
resolution |
string |
N |
Resolution in milliseconds. Accepted values are: 86400000, 3600000 |
86400000 |
86400000 |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |
Removes all device data for the specified time range. Defaults to all data.
result = client.device.remove_data(
applicationId: my_application_id,
deviceId: my_device_id)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Organization, all.User, device.*, or device.removeData.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
start |
string |
N |
Start time of export (ms since epoch - 0 means now, negative is relative to now) |
1 |
1465790400000 |
end |
string |
N |
End time of export (ms since epoch - 0 means now, negative is relative to now) |
0 |
1465790400000 |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |
Send a command to a device
result = client.device.send_command(
applicationId: my_application_id,
deviceId: my_device_id,
deviceCommand: my_device_command)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Device, all.Organization, all.User, device.*, or device.sendCommand.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
deviceCommand |
Device Command |
Y |
Command to send to the device |
|
Device Command Example |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
200 |
Success |
If command was successfully sent |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |
Send the current state of the device
result = client.device.send_state(
applicationId: my_application_id,
deviceId: my_device_id,
deviceState: my_device_state)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Device, all.Organization, all.User, device.*, or device.sendState.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
deviceState |
Device State or States |
Y |
A single device state object, or an array of device state objects |
|
Device State or States Example |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
200 |
Success |
If state was successfully received |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |
Set the current connection status of the device
result = client.device.set_connection_status(
applicationId: my_application_id,
deviceId: my_device_id,
connectionStatus: my_connection_status)
puts result
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.Application, all.Device, all.Organization, all.User, device.*, or device.setConnectionStatus.
Name |
Type |
Required |
Description |
Default |
Example |
applicationId |
string |
Y |
ID associated with the application |
|
575ec8687ae143cd83dc4a97 |
deviceId |
string |
Y |
ID associated with the device |
|
575ecf887ae143cd83dc4aa2 |
connectionStatus |
Device Connection Status |
Y |
The current connection status of the device |
|
Device Connection Status Example |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
200 |
Success |
If connection status was successfully applied |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
404 |
Error |
Error if device was not found |