Examples
How to use UJL
Devices
Get all devices in the account
const allDevices = await Ubidots.devices.all();Get the first device in the account
const firstDevice = await Ubidots.devices.first();
// This is equivalent to
const firstDevice = (await Ubidots.devices.all())[0];Get the first 1000 devices in the account
const devicesPaginated = (await Ubidots.devices.paginate(1, 1000)).resultsGet the lastActivity field from devices
lastActivity field from devices const allDevicesLastActivity = await Ubidots.devices.addRawParam('fields', 'lastActivity').get();Get the lastActivity and variablesCount fields from devices
lastActivity and variablesCount fields from devicesconst device = await Ubidots.devices.addRawParams(
{
fields: 'lastActivity,variablesCount'
}
).get();Get the lastActivity and variablesCount fields from a specific device using its label
lastActivity and variablesCount fields from a specific device using its labelGet a device by label or ID
Get a set of devices based on their type
Variables
Get all the variables in the account
Get the first variable in the account:
Get the first 100 variables in the account:
Get the lastActivity field from variables
lastActivity field from variablesGet the lastActivity and label fields from all variables
lastActivity and label fields from all variablesGet the lastActivity and label fields from a specific variable
lastActivity and label fields from a specific variableGet a variable by ID:
Get a set of variables based on their label:
Send data
First, you need to get the device object and then, the variables to which you want to send the data:
Send a value:
Send a value with timestamp:
Send a value with timestamp and context:
Get all the users in the account
Get all the organizations in the account
Get all the devices asigned to an organization
Get all the dashboards in the account
Last updated
Was this helpful?