Devices and Services

Application Types

Application types are service type definitions which are used as parameters for Get Devices By An Attribute and in services. In the case of services only the ID is returned so you will reference this response.
1
query {
2
applicationTypes {
3
id
4
name
5
description
6
port
7
protocol
8
proxy
9
}
10
}
Copied!
Response Example
1
{
2
"data": {
3
"applicationTypes": [
4
{
5
"id": 1,
6
"name": "TCP",
7
"description": "Generic TCP",
8
"port": null,
9
"protocol": "TCP",
10
"proxy": false
11
},
12
{
13
"id": 4,
14
"name": "VNC",
15
"description": "VNC remote desktop",
16
"port": 5900,
17
"protocol": "TCP",
18
"proxy": false
19
},
20
...
21
]
22
}
23
}
Copied!
Attributes
Data Type
Description
ID
Int
The primary key of the application type used in queries such as Get Devices By An Attribute
name
String
The given short name for an application type. This is unique
description
String
Further explanation of the application type
port
Int
The default port for the application type. This can be overridden on a service by service basis
protocol
String
The protocol used when creating a connection to this application type
proxy
Boolean
Whether the application type will use a reverse proxy when creating a proxy connection.

Get Your Devices

In this example we will be fetching your devices using graphQL. If you wish to get devices which meet a certain criteria like inactive devices, use the Attribute Query. Devices uses pagination for the result set. Please refer to the pagination explanation for more on working with these results.
This example only shows some of the variables and available attributes for the device and service collections.
1
#Query
2
3
query getDevices($size: Int, $from: Int, $sort: String) {
4
login {
5
devices(size: $size, from: $from, sort: $sort) {
6
total
7
hasMore
8
items {
9
id
10
name
11
hardwareId
12
created
13
services {
14
id
15
name
16
}
17
}
18
}
19
}
20
}
21
22
#Variables
23
{
24
"size": 1000,
25
"from": 0,
26
"sort": 'name',
27
}
Copied!
Response Example
1
{
2
"data": {
3
"login": {
4
"devices": {
5
"total": 1200,
6
"hasMore": true,
7
"items": [
8
{
9
"id": "8X:XX:XX:00:29:01:8e:ed",
10
"name": "bento",
11
"hardwareId": "dc:a6:32:19:8b:a3-xWoYf46uJ6QdtPXTloLb",
12
"created": "2019-12-20T22:13:46.000Z",
13
"services": [
14
{
15
"id": "8X:XX:XX:00:29:01:8e:ed",
16
"name": "ssh service"
17
}
18
]
19
},
20
...
21
]
22
}
23
}
24
}
25
}
Copied!

Get Devices By An Attribute

In this example we will be fetching all devices with "tim" in the name using graphQL. This will return all devices with "tim" in the name and is not case sensitive. You can use any number of combinations of available attributes to narrow your result set further.
Other available parameters available:
Parameter
Data Type
Description
application
Int
ID of the application type (service type). Using this parameter will return devices which have services of a given type and if the services are returned in the query will only include the services of this type. For example, if you request an application type id which is mapped to SSH and include the services, only services of type of SSH will be returned in the services array even when there are other services defined on the device.
To get available service types, please see Application Types
hardwareid
String
The hardware ID associated with the device.
name
String
String which is present in the name of the device and is not case sensitive.
platform
[Int]
Array of platform IDs
state
String
accepted values "active" and "inactive"
Additional attributes will become available over time. Please refer to the schema documentation for the extensive list.
This example only shows some of the variables and available attributes for the device and service collections.
1
#Query
2
3
query getDevices($size: Int, $from: Int, $sort: String, $state: String, $name: String) {
4
login {
5
devices(size: $size, from: $from, sort: $sort, state: $state, name: $name) {
6
total
7
hasMore
8
items {
9
id
10
name
11
hardwareId
12
created
13
services {
14
id
15
name
16
}
17
}
18
}
19
}
20
}
21
22
#Variables
23
{
24
"size": 1000,
25
"from": 0,
26
"sort": 'name',
27
"state": "inactive",
28
"name": "tim"
29
}
Copied!
Once you get the results, if the hasMore response returns true you know to do another fetch and in this case the from will increment to 1001 to fetch the next set, you could also determine this by iteration until you get to the total. Size is limited to 1000 max in each return.
Response Example
1
{
2
"data": {
3
"login": {
4
"devices": {
5
"total": 1200,
6
"hasMore": true,
7
"items": [
8
{
9
"id": "8X:XX:XX:00:29:01:8e:ed",
10
"name": "Bento Time Machine",
11
"hardwareId": "dc:a6:32:19:8b:a3-xWoYf46uJ6QdtPXTloLb",
12
"created": "2019-12-20T22:13:46.000Z",
13
"services": [
14
{
15
"id": "8X:XX:XX:00:29:01:8e:ed",
16
"name": "ssh service"
17
}
18
]
19
},
20
...
21
]
22
}
23
}
24
}
25
}
Copied!

Update a Device/Service Name

You can update a device or service name by using a REST-API request. You may need to fetch your device list to get the ID of the service you wish to modify. When you want to update a device name, update using the device ID.
post
/apv/v27/device/name
Update Service Name
Last modified 3mo ago