https://help.tago.io/portal/en/kb/articles/3-devices#Adding_devices Adding Devices
If receive an error "Authorization Denied", check policy Device / Create in Access Management.
const TAGOIO_DATABASE_CONNECTOR = "62333bd36977fc001a2990c8";
const TAGOIO_STORAGE_NETWORK = "62336c32ab6e0d0012e06c04";
const newDevice = await Resources.devices.create({
name: "My Device",
connector: TAGOIO_DATABASE_CONNECTOR,
network: TAGOIO_STORAGE_NETWORK,
type: "mutable"
});
console.log(newDevice); // { device: 'device-id-123', token: 'token-123' }
Optional
chunkID: stringhttps://help.tago.io/portal/en/kb/articles/55-data-export Data Export
If receive an error "Authorization Denied", check policy Device / Export Data in Access Management.
const deviceID = "your-device-id";
const timestamp = Date.now()
const result = await Resources.devices.dataBackup({
deviceID: "device-id-123",
file_address: `/backups/${deviceID}/${timestamp}`,
headers: true
});
console.log(result); // { file_address: 'backups/your-device-id/1736433519380.csv' }
Experimental
Optional
queryParams: DataQueryDelete data records in a mutable device using the profile token and device ID.
See the example to understand how to use this method properly to have full control on what to delete.
! If query parameters are empty, last 15 data for the device will be deleted.
https://help.tago.io/portal/en/kb/articles/device-data#Editing_and_deleting_variables_individually Editing and deleting variables individually
https://help.tago.io/portal/en/kb/articles/3-devices#Managing_and_customizing_your_device Managing and Customizing Your Device
Edit data records in a mutable device using the profile token and device ID.
The updatedData
can be a single data record or an array of records to be updated,
each of the records must have the id
of the record and the fields to be updated.
https://help.tago.io/portal/en/kb/articles/device-data#Editing_and_deleting_variables_individually Editing and deleting variables individually
https://help.tago.io/portal/en/kb/articles/device-data#Emptying_your_Device_Data Emptying your Device Data
Experimental
https://help.tago.io/portal/en/kb/articles/chunk-management Chunk Management
Optional
queryParams: DataQueryhttps://help.tago.io/portal/en/kb/articles/device-data Device data management
Experimental
Optional
params: DataQueryStreamingOptional
options: OptionsStreaminghttps://help.tago.io/portal/en/kb/articles/device-data Device data management
Optional
queryObj: TIf receive an error "Authorization Denied", check policy Device / Access in Access Management.
const list = await Resources.devices.list({
page: 1,
fields: ["id", "name"],
amount: 10,
orderBy: ["name", "asc"]
});
console.log(list); // [ { id: '123', name: 'Device #1' ...}, { id: '456', name: 'Device #2' ...} ]
Optional
queryObj: Omit<DeviceQuery, "page" | "amount">Optional
options: OptionsStreamingOptional
sentStatus: booleanhttps://help.tago.io/portal/en/kb/articles/configuration-parameters-for-devices Configuration Parameters for Devices
https://help.tago.io/portal/en/kb/articles/configuration-parameters-for-devices Configuration Parameters for Devices
Optional
paramID: stringhttps://help.tago.io/portal/en/kb/articles/configuration-parameters-for-devices Configuration Parameters for Devices
https://help.tago.io/portal/en/kb/articles/95-device-emulator Device Emulator
If receive an error "Authorization Denied", check policy Device / Send data in Access Management.
const result = await Resources.devices.sendDeviceData("device-id-123", {
variable: "temperature",
unit: "F",
value: 55,
location: { lat: 42.2974279, lng: -85.628292 }
});
console.log(result); // 1 Data Added
Experimental
Optional
options: Omit<OptionsStreaming, "neverStop">https://help.tago.io/portal/en/kb/articles/95-device-emulator Device Emulator
https://help.tago.io/portal/en/kb/articles/4-device-token Device Token
https://help.tago.io/portal/en/kb/articles/4-device-token Device Token
Optional
queryObj: Thttps://help.tago.io/portal/en/kb/articles/4-device-token Device Token
If receive an error "Authorization Denied", check policy Device / Token access in Access Management.
const tokens = await Resources.devices.tokenList("device-id-123", {
page: 1,
fields: ["name", "token"],
amount: 10
});
console.log(tokens); // [ { name: 'Default', token: 'token-id-123', expire_time: 'never' } ]
Description
Gets the amount of data stored in a device.
See
https://help.tago.io/portal/en/kb/articles/device-data#Amount_of_data_records Amount of data records
Example
If receive an error "Authorization Denied", check policy Device / Access in Access Management.