Below are the various requests that can be performed against the
Devices resource, as well as the expected
parameters and the potential responses.
Attribute Names
Gets the attribute names that match the given query. Maximum 1K returned.
Method And Url
GET https://api.losant.com/applications/APPLICATION_ID/devices/attributeNames
Authentication
A valid api access token is required to access this endpoint. 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, devices.*, or devices.attributeNames.
POST https://api.losant.com/applications/APPLICATION_ID/devices/delete
Authentication
A valid api access token is required to access this endpoint. The token must
include at least one of the following scopes:
all.Application, all.Organization, all.User, devices.*, or devices.delete.
Request Path Components
Path Component
Description
Example
APPLICATION_ID
ID associated with the application
575ec8687ae143cd83dc4a97
Request Headers
Name
Required
Description
Default
Authorization
Y
The token for authenticating the request, prepended with Bearer
Request Body
The body of the request should be serialized JSON that validates against
the Devices Delete Post schema. For example, the following would be a
valid body for this request:
Gets the device names that match the given query. Maximum 1K returned.
Method And Url
GET https://api.losant.com/applications/APPLICATION_ID/devices/deviceNames
Authentication
A valid api access token is required to access this endpoint. 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, devices.*, or devices.deviceNames.
POST https://api.losant.com/applications/APPLICATION_ID/devices/export
Authentication
A valid api access token is required to access this endpoint. 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, devices.*, or devices.export.
Request Path Components
Path Component
Description
Example
APPLICATION_ID
ID associated with the application
575ec8687ae143cd83dc4a97
Request Query Parameters
Name
Required
Description
Default
Example
email
N
Email address to send export to. Defaults to current user’s email.
The token for authenticating the request, prepended with Bearer
Request Body
The body of the request should be serialized JSON that validates against
the Devices Metadata Export Post schema. For example, the following would be a
valid body for this request:
GET https://api.losant.com/applications/APPLICATION_ID/devices
Authentication
A valid api access token is required to access this endpoint. 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, devices.*, or devices.get.
Request Path Components
Path Component
Description
Example
APPLICATION_ID
ID associated with the application
575ec8687ae143cd83dc4a97
Request Query Parameters
Name
Required
Description
Default
Example
sortField
N
Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated, connectionStatus
name
sortField=name
sortDirection
N
Direction to sort the results by. Accepted values are: asc, desc
asc
sortDirection=asc
page
N
Which page of results to return
0
page=0
perPage
N
How many items to return per page
100
perPage=10
filterField
N
Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
filterField=name
filter
N
Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
filter=my * device
deviceClass
N
Filter the devices by the given device class or classes. See Device Class Filter for more details.
Device filter JSON object which overrides the filterField, filter, deviceClass, tagFilter, and parentId parameters. See Advanced Device Query for more details.
Retrieve the composite last complete state of the matching devices
Method And Url
GET https://api.losant.com/applications/APPLICATION_ID/devices/compositeState
Authentication
A valid api access token is required to access this endpoint. 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, devices.*, or devices.getCompositeState.
Request Path Components
Path Component
Description
Example
APPLICATION_ID
ID associated with the application
575ec8687ae143cd83dc4a97
Request Query Parameters
Name
Required
Description
Default
Example
start
N
Start of time range to look at to build composite state
1
start=1465790400000
end
N
End of time range to look at to build composite state
0
end=1465790400000
attributes
N
Comma-separated list of attributes to include. When not provided, returns all attributes.
attributes=myAttr1,myAttr2
sortField
N
Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated, connectionStatus
name
sortField=name
sortDirection
N
Direction to sort the results by. Accepted values are: asc, desc
A valid api access token is required to access this endpoint. The token must
include at least one of the following scopes:
all.Application, all.Organization, all.User, devices.*, or devices.patch.
Request Path Components
Path Component
Description
Example
APPLICATION_ID
ID associated with the application
575ec8687ae143cd83dc4a97
Request Headers
Name
Required
Description
Default
Authorization
Y
The token for authenticating the request, prepended with Bearer
Request Body
The body of the request should be serialized JSON that validates against
the Devices Patch schema. For example, the following would be a
valid body for this request:
{"updateFields":{"name":"My Updated Device","description":"Description of my updated device","tags":[{"key":"TagKey","value":"TagValue"}],"attributes":[{"name":"voltage","dataType":"number"}],"deviceClass":"standalone"},"deviceIds":["575ecec57ae143cd83dc4a9f","575ecec57ae143cd83dc4a9e","575ecec57ae143cd83dc4a9a"]}
Curl Example
curl-H'Content-Type: application/json'\-H'Accept: application/json'\-H'Authorization: Bearer YOUR_API_ACCESS_TOKEN'\-X PATCH \-d'{"updateFields":{"name":"My Updated Device","description":"Description of my updated device","tags":[{"key":"TagKey","value":"TagValue"}],"attributes":[{"name":"voltage","dataType":"number"}],"deviceClass":"standalone"},"deviceIds":["575ecec57ae143cd83dc4a9f","575ecec57ae143cd83dc4a9e","575ecec57ae143cd83dc4a9a"]}'\
https://api.losant.com/applications/APPLICATION_ID/devices
Creates an export of payload count information for the matching devices
Method And Url
POST https://api.losant.com/applications/APPLICATION_ID/devices/payloadCounts
Authentication
A valid api access token is required to access this endpoint. 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, devices.*, or devices.payloadCounts.
Request Path Components
Path Component
Description
Example
APPLICATION_ID
ID associated with the application
575ec8687ae143cd83dc4a97
Request Headers
Name
Required
Description
Default
Authorization
Y
The token for authenticating the request, prepended with Bearer
Request Body
The body of the request should be serialized JSON that validates against
the Devices Payload Count Export Post schema. For example, the following would be a
valid body for this request:
POST https://api.losant.com/applications/APPLICATION_ID/devices
Authentication
A valid api access token is required to access this endpoint. The token must
include at least one of the following scopes:
all.Application, all.Organization, all.User, devices.*, or devices.post.
Request Path Components
Path Component
Description
Example
APPLICATION_ID
ID associated with the application
575ec8687ae143cd83dc4a97
Request Query Parameters
Name
Required
Description
Default
Example
tagsAsObject
N
Return tags as an object map instead of an array
tagsAsObject=true
attributesAsObject
N
Return attributes as an object map instead of an array
attributesAsObject=false
Request Headers
Name
Required
Description
Default
Authorization
Y
The token for authenticating the request, prepended with Bearer
Request Body
The body of the request should be serialized JSON that validates against
the Device Post schema. For example, the following would be a
valid body for this request:
{"name":"My New Device","description":"Description of my new device","tags":[{"key":"TagKey","value":"TagValue"}],"attributes":[{"name":"voltage","dataType":"number"}],"deviceClass":"standalone"}
Curl Example
curl-H'Content-Type: application/json'\-H'Accept: application/json'\-H'Authorization: Bearer YOUR_API_ACCESS_TOKEN'\-X POST \-d'{"name":"My New Device","description":"Description of my new device","tags":[{"key":"TagKey","value":"TagValue"}],"attributes":[{"name":"voltage","dataType":"number"}],"deviceClass":"standalone"}'\
https://api.losant.com/applications/APPLICATION_ID/devices
Removes all device data for the specified time range. Defaults to all data.
Method And Url
POST https://api.losant.com/applications/APPLICATION_ID/devices/removeData
Authentication
A valid api access token is required to access this endpoint. The token must
include at least one of the following scopes:
all.Application, all.Organization, all.User, devices.*, or devices.removeData.
Request Path Components
Path Component
Description
Example
APPLICATION_ID
ID associated with the application
575ec8687ae143cd83dc4a97
Request Headers
Name
Required
Description
Default
Authorization
Y
The token for authenticating the request, prepended with Bearer
Request Body
The body of the request should be serialized JSON that validates against
the Devices Remove Data Post schema. For example, the following would be a
valid body for this request:
POST https://api.losant.com/applications/APPLICATION_ID/devices/command
Authentication
A valid api access token is required to access this endpoint. The token must
include at least one of the following scopes:
all.Application, all.Device, all.Organization, all.User, devices.*, or devices.sendCommand.
Request Path Components
Path Component
Description
Example
APPLICATION_ID
ID associated with the application
575ec8687ae143cd83dc4a97
Request Headers
Name
Required
Description
Default
Authorization
Y
The token for authenticating the request, prepended with Bearer
Request Body
The body of the request should be serialized JSON that validates against
the Multi Device Command schema. For example, the following would be a
valid body for this request:
Gets the unique tag keys for devices that match the given query. Maximum 1K returned.
Method And Url
GET https://api.losant.com/applications/APPLICATION_ID/devices/tagKeys
Authentication
A valid api access token is required to access this endpoint. 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, devices.*, or devices.tagKeys.
Gets the unique tag values for the given key for devices that match the given query. Maximum 1K returned.
Method And Url
GET https://api.losant.com/applications/APPLICATION_ID/devices/tagValues
Authentication
A valid api access token is required to access this endpoint. 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, devices.*, or devices.tagValues.