Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Device Resource


(warning)

Warning

Microvisor Public Beta

Microvisor is in a pre-release phase and the information contained in this document is subject to change. Some features referenced below may not be fully available until Microvisor's General Availability (GA) release.

A Device instance represents a single Microvisor-empowered IoT device. For clarity, device (no cap) refers to physical hardware. Device (initial cap) refers to a Device API resource.

Device resources are accessed at this endpoint:


_10
https://microvisor.twilio.com/v1/Devices

Make a GET request to the endpoint to receive a list (in JSON) of all Device resources.

Every Device instance can be referenced in the API either by its unique SID or a user-defined unique name:


_10
https://microvisor.twilio.com/v1/Devices/{sid}
_10
https://microvisor.twilio.com/v1/Devices/{uniqueName}

The Device instance representing a real device is used to deploy uploaded code to that device.

(information)

Device Properties

device-properties page anchor
Resource properties
sidtype: SID<UV>Not PII

A 34-character string that uniquely identifies this Device.


unique_nametype: stringNot PII

A developer-defined string that uniquely identifies the Device. This value must be unique for all Devices on this Account. The unique_name value may be used as an alternative to the sid in the URL path to address the resource.


account_sidtype: SID<AC>Not PII

The unique SID identifier of the Account.


apptype: objectNot PII

Information about the target App and the App reported by this Device. Contains the properties target_sid, date_targeted, update_status (one of up-to-date, pending and error), update_error_code, reported_sid and date_reported.


loggingtype: objectNot PII

Object specifying whether application logging is enabled for this Device. Contains the properties enabled and date_expires.


date_createdtype: string<DATE TIME>Not PII

The date that this Device was created, given in ISO 8601(link takes you to an external page) format.


date_updatedtype: string<DATE TIME>Not PII

The date that this Device was last updated, given in ISO 8601(link takes you to an external page) format.


urltype: string<URI>Not PII

The URL of this resource.


linkstype: object<URI MAP>Not PII

The absolute URLs of related resources.


The table below describes the available status values of a Device instance:

StatusDescription
up-to-dateThe device has received with the most recent application code deployed to it
scheduledApplication code has been marked for deployment but has yet to be installed on the device
errorApplication code marked for deployment could not be downloaded for some reason

GET https://microvisor.twilio.com/v1/Devices/{Sid}

Parameters

fetch-parameters page anchor
URI parameters
Sidtype: stringNot PII
Path Parameter

A 34-character string that uniquely identifies this Device.

Request a single Device resource

request-a-single-device-resource page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.microvisor.v1.devices('UVxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
_10
.fetch()
_10
.then(device => console.log(device.sid));

Output

_25
{
_25
"sid": "UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"unique_name": "This is my device; there are many like it.",
_25
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"app": {
_25
"target_sid": "KAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"target_hash": null,
_25
"date_targeted": "2021-01-01T12:34:56Z",
_25
"update_status": "up-to-date",
_25
"update_error_code": 0,
_25
"reported_sid": "KAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"date_reported": "2021-01-01T12:34:56Z"
_25
},
_25
"logging": {
_25
"enabled": true,
_25
"date_expires": "2021-01-01T12:34:56Z"
_25
},
_25
"date_created": "2021-01-01T12:34:56Z",
_25
"date_updated": "2021-01-01T12:34:56Z",
_25
"url": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"links": {
_25
"device_configs": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Configs",
_25
"device_secrets": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Secrets"
_25
}
_25
}


GET https://microvisor.twilio.com/v1/Devices

URI parameters
PageSizetype: integerNot PII
Query Parameter

How many resources to return in each list page. The default is 50, and the maximum is 1000.


Pagetype: integerNot PII
Query Parameter

The page index. This value is simply for client state.


PageTokentype: stringNot PII
Query Parameter

The page token. This is provided by the API.

Request a list of Device resources

request-a-list-of-device-resources page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.microvisor.v1.devices
_10
.list({limit: 20})
_10
.then(devices => devices.forEach(d => console.log(d.sid)));

Output

_12
{
_12
"devices": [],
_12
"meta": {
_12
"page": 0,
_12
"page_size": 50,
_12
"first_page_url": "https://microvisor.twilio.com/v1/Devices?PageSize=50&Page=0",
_12
"previous_page_url": "https://microvisor.twilio.com/v1/Devices?PageSize=50&Page=0",
_12
"url": "https://microvisor.twilio.com/v1/Devices?PageSize=50&Page=0",
_12
"next_page_url": "https://microvisor.twilio.com/v1/Devices?PageSize=50&Page=1",
_12
"key": "devices"
_12
}
_12
}


POST https://microvisor.twilio.com/v1/Devices/{Sid}

URI parameters
Sidtype: stringNot PII
Path Parameter

A 34-character string that uniquely identifies this Device.


Request body parameters
UniqueNametype: stringNot PII

A unique and addressable name to be assigned to this Device by the developer. It may be used in place of the Device SID.


TargetApptype: stringNot PII

The SID or unique name of the App to be targeted to the Device.


LoggingEnabledtype: booleanNot PII

A Boolean flag specifying whether to enable application logging. Logs will be enabled or extended for 24 hours.


RestartApptype: booleanNot PII

Set to true to restart the App running on the Device.

Give a Device a memorable name

give-a-device-a-memorable-name page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.microvisor.v1.devices('UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.update({uniqueName: 'My Device Name'})
_10
.then(device => console.log(device.uniqueName));

Output

_25
{
_25
"sid": "UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"unique_name": "My Device Name",
_25
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"app": {
_25
"target_sid": "KAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"target_hash": null,
_25
"date_targeted": "2021-01-01T12:34:56Z",
_25
"update_status": "pending",
_25
"update_error_code": 0,
_25
"reported_sid": null,
_25
"date_reported": "2021-01-01T12:34:56Z"
_25
},
_25
"logging": {
_25
"enabled": false,
_25
"date_expires": null
_25
},
_25
"date_created": "2015-07-30T20:00:00Z",
_25
"date_updated": "2015-07-30T20:00:00Z",
_25
"url": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"links": {
_25
"device_configs": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Configs",
_25
"device_secrets": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Secrets"
_25
}
_25
}

(information)

Info

Remember, a Device can be identified either by is SID, or by its unique name, if you have applied one.

Deploy an App to the Device

deploy-an-app-to-the-device page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.microvisor.v1.devices('UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.update({targetApp: 'KAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'})
_10
.then(device => console.log(device.uniqueName));

Output

_25
{
_25
"sid": "UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"unique_name": "UniqueName",
_25
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"app": {
_25
"target_sid": "KAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"target_hash": null,
_25
"date_targeted": "2021-01-01T12:34:56Z",
_25
"update_status": "pending",
_25
"update_error_code": 0,
_25
"reported_sid": null,
_25
"date_reported": "2021-01-01T12:34:56Z"
_25
},
_25
"logging": {
_25
"enabled": false,
_25
"date_expires": null
_25
},
_25
"date_created": "2015-07-30T20:00:00Z",
_25
"date_updated": "2015-07-30T20:00:00Z",
_25
"url": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"links": {
_25
"device_configs": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Configs",
_25
"device_secrets": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Secrets"
_25
}
_25
}

Enable application code logging

enable-application-code-logging page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.microvisor.v1.devices('UVxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
_10
.update({loggingEnabled: true})
_10
.then(device => console.log(device.uniqueName));

Output

_25
{
_25
"sid": "UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"unique_name": "UniqueName",
_25
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"app": {
_25
"target_sid": "KAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"target_hash": null,
_25
"date_targeted": "2021-01-01T12:34:56Z",
_25
"update_status": "pending",
_25
"update_error_code": 0,
_25
"reported_sid": null,
_25
"date_reported": "2021-01-01T12:34:56Z"
_25
},
_25
"logging": {
_25
"enabled": false,
_25
"date_expires": null
_25
},
_25
"date_created": "2015-07-30T20:00:00Z",
_25
"date_updated": "2015-07-30T20:00:00Z",
_25
"url": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"links": {
_25
"device_configs": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Configs",
_25
"device_secrets": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Secrets"
_25
}
_25
}

(information)

Info

Application code logging is enabled by default.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.microvisor.v1.devices('UVxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
_10
.update({restartApp: true})
_10
.then(device => console.log(device.uniqueName));

Output

_25
{
_25
"sid": "UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"unique_name": "UniqueName",
_25
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"app": {
_25
"target_sid": "KAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"target_hash": null,
_25
"date_targeted": "2021-01-01T12:34:56Z",
_25
"update_status": "pending",
_25
"update_error_code": 0,
_25
"reported_sid": null,
_25
"date_reported": "2021-01-01T12:34:56Z"
_25
},
_25
"logging": {
_25
"enabled": false,
_25
"date_expires": null
_25
},
_25
"date_created": "2015-07-30T20:00:00Z",
_25
"date_updated": "2015-07-30T20:00:00Z",
_25
"url": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"links": {
_25
"device_configs": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Configs",
_25
"device_secrets": "https://microvisor.twilio.com/v1/Devices/UVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Secrets"
_25
}
_25
}

Restarting an app using this call will instruct Microvisor to start the loaded application afresh. This can be a useful call to make during remote debugging, particularly if your application is experiencing unexpected behavior right after it starts.


Rate this page: