TeamViewer IoT Cloud API

Introduction


Attention! Dear Users. Please note that the current Teamviewer IoT Cloud API will be deprecated as of 31.12.2021 and replaced with TeamViewer Web API so we strongly suggest to move to Web API and also use only that API going forward. You can find the documentation by this Link

The IoT Public API uses the RESTful approach.
Only GET (for get actions) and POST (for create, update and delete actions) requests are allowed. Other methods will be rejected silently.

Operation HTTP Method
Create POST
Read (Retrieve) GET
Update (Modify) POST
Delete (Destroy) POST

The API server is located at api.teamviewer-iot.com and supports only HTTPS connections.
The API requests should be in the following RESTful form:

https://api.teamviewer-iot.com/{action}

For example:
https://api.teamviewer-iot.com/devices

Request Headers

The following HTTPS Headers should be in any request:

Header Value Description
Authorization Authorization: Bearer {apikey} API Key can be obtained from API Key menu item in IoT Dashboard.
Accept Accept: application/json; Version={version}; Version is not mandatory. If version is not set than latest api version is considered. Current api version is 2.0.0.

POST Requests

POST requests require to send data as a JSON in request body. Action and payload details are provided per each request.

Field Type Description
action String Possible values are.
  • create
  • update
  • delete
payload JSON Details required for certain request. E.g. in order to add dashboard, dasboard name should be provided.

Example of Request Body

{
   "action": "create",
   "payload":{
			"name": "My Dashboard"
	      }
}

Error Response

Error response for all API actions has the same structure:

Field Type Description
error JSON Available fields are:
code - unique integer value of the error
desc - description of the error

Error Response: (HTTP/1.1 400 NOK)

{
	"error": {
		"code": "11",
		"desc": "Warn.could not detect any correct action."
	}
}

1.1 Get Assignment Token

Success Response

Field Type Description
data String Assignment token is used to assign the device to the account.
GET
https://api.teamviewer-iot.com/assignmentToken

Success Response: (HTTP/1.1 200 Ok)

{
   "data": "8704847-hJtfCI6YS1Lr9i6dW3Yu",
   "status": "OK"
}

1.2 Renew Assignment Token

Success Response

Field Type Description
data String Assignment token is used to assign the device to the account.

Request-Example:

POST
https://api.teamviewer-iot.com/assignmentToken

 

{
   "action": "update",
   "payload": {
      "action": "update"
   }
}

Success-Response: (HTTP/1.1 200 OK)

{
   "data": "8704847-hJtfCI6YS1Lr9i6dW3Yu",
   "status": "OK"
}

2.1 Get User Info

Success Response

Field Type Description
firstname String First name of the user
lastname String Last name of the user
email String Email address of the user
license JSON Existing license of the user
eulaagreement Integer 1 if user has accepted EULA, 0 otherwise.
GET
https://api.teamviewer-iot.com/users

Success Response: (HTTP/1.1 200 Ok)

{
   "data": {
      "license": {
         "type": "Free",
         "version": 13
      },
      "firstname": "John",
      "lastname": "Smith",
      "id": "u100000",
      "email": "john.smith@example.com",
      "eulaagreement": 1
   },
   "status": "OK"
}

3.1 Get Inventory

Returns nested list of all groups, devices, contacts, sensors and metrics.

Success Response

Field Type Description
id Long Unique ID of group
name String Name of the group
permission Integer User's permissions for the group.
1 - Read Only
2 - Read/Write
3 - Owned by user
4 - Full Access
sharedWith JSON[] List of the contacts the group is shared with. See the structure of contact JSON object below.
userId Long ID of the contact
name String Name of the contact
permission Integer Contact's permissions for the group.
1 - Read Only
2 - Read/Write
3 - Owned by user
4 - Full Access
Contacts JSON[] List of the contacts in the group. See the structure of contact JSON object below.
id Long ID of the contact
name String Name of the contact
state Integer Availability status of the contact.
0 - Online
1 - Busy
2 - Away
3 - Offline
email String Email of the contact
devices JSON[] List of the devices in the group. See the structure of device JSON object below.
id Long ID that is unique to this device and can be used to start a remote control session
buddyId Long ID that is unique for this device within current user's device list.
name String Name that the current user has given to this device
deviceType Integer Type of the device - IoT or else.
1 - not IOT device
2 - IOT device
state Integer Availability status of the device.
1 - Offline
2 - Online
description String The description that the current user has set for this device
version String Version of the IoT agent running on the device.
alarm Integer The highest severity of the alarms associated with device.
1 - Critical
2 - Major
3 - Minor
4 - Warning
sensors JSON[] List of the sensors in the device. See the structure of sensor JSON object below.
id Long ID of the Sensor
name String Name of the Sensor
provisionedsensorid String ID of the sensor in the scope of device MQTT API)
scriptPath String Path of the script being executed by TeamViewer IoT agent in order to get metric values.
sensorType
optional
Integer
  • 1 - Custom (default)
  • 2 - OPC-UA
metricsCount Integer Number of metrics of corresponding sensor
frequency Json Metric values' update frequency. See the structure of frequency JSON object below.
type String Time interval type.
  • minutes
  • seconds
value Integer Number of minutes or seconds.
metrics JSON[] List of the metrics in the sensor. See the structure of metric JSON object below.
id String ID of the metric
name String Name of the metric
valueUnit String One of the common unit of measures set for the metric, e.g. Celsius, Pascal, etc.
valueAnnotation String Custom unit of measure set for the metric.
valueType String Data type of the metric.
  • bool
  • string
  • double
  • integer
params
optional
JSON Now available only for opc-ua sensor.
Parameters for the script. See the structure of param JSON below.
nodeids String Node ids and metric ids mapping separated by the space.
"nodeId1 metricId1 nodeId2 metricId2"

Request-Example:

GET
https://api.teamviewer-iot.com/inventory

Success-Response: (HTTP/1.1 200 OK)

{
   "data": [
      {
         "id": 33858,
         "name": "My computers",
         "permission": 3,
         "owner": 29469,
         "devices": [
            {
               "id": 2000000472,
               "buddyId": 9135,
               "name": "IoT Gateway 2D",
               "deviceType": 2,
               "state": 1,
               "sensorsCount": "7",
               "metricsCount": "21",
               "description": "my IoT device",
               "isMonitoringEnabled": true,
               "version": "2.6.3",
               "alarm": "2",
               "systemHealthTypes": {
                  "CPU": true,
                  "Memory": false,
                  "Load": false
               },
               "sensors": [
                  {
                     "id": 106631,
                     "provisionedSensorId": "6e1033c0c1e04790a7b25670a84a930a",
                     "name": "CPU",
                     "systemHealthType": 1,
                     "isPluginSensor": false,
                     "scriptPath": "",
                     "metricsCount": "6",
                     "frequency": {
                        "type": "minutes",
                        "value": 10
                     },
                     "metrics": [
                        {
                           "id": "d070dcc1ac904f8eb7f011d5a492fc09",
                           "name": "User CPU Usage",
                           "valueUnit": "SI.Temperature.CELSIUS",
                           "valueType": "double",
                           "alarm": "1"
                        },
                        {
                           "id": "66eec832592c474a9acf67900569fd51",
                           "name": "System CPU Usage",
                           "valueAnnotation": "Percent",
                           "valueType": "double"
                        }
                     ]
                  }
               ]
            }
         ],
         "sharedWith": [
            {
               "name": "qaiotdev",
               "permission": "full"
            }
         ],
         "contacts": [
            {
               "id": 6574,
               "name": "qaiotdev",
               "state": 3,
               "email": "qaiotdev@teamviewer.com"
            }
         ]
      }
   ],
   "status": "OK",
   "timestamp": 1586941553678
}

4.1 Get Devices

Success Response

Field Type Description
id Long ID that is unique to this device and can be used to start a remote control session
buddyId Long ID that is unique for this device within current user's device list.
name String Name that the current user has given to this device
devicetype Integer Type of the device - IoT or else.
1 - not IOT device
2 - IOT device

Request-Example:

GET
https://api.teamviewer-iot.com/devices

Success-Response: (HTTP/1.1 200 OK)

{
   "data": [
      {
         "id": 2064781955,
         "name": "IoT Gateway 3B",
         "devicetype": 2,
         "buddyid": 127451284,
      }
   ],
   "status": "OK"
}

5.1 Create Group

Request Body

Field Type Description
action String create
name String Group name
devices
optional
JSON[] The list of device ids in following format
["deviceid1","deviceid2"]

Success Response

Field Type Description
id Long ID of the newly created group

Request-Example:

POST
https://api.teamviewer-iot.com/groups

Request-Body:

{
   "action": "create",
   "payload": {
      "name": "New Group",
	  "devices": ["456931800","678991800"]
   }
}

Success-Response: (HTTP/1.1 200 OK)

{
    "data": {
        "id": 29988
    }
}

5.2 Delete Group

Request Body

Field Type Description
action String delete
id Long ID of the group

Request-Example:

POST
https://api.teamviewer-iot.com/groups

Request-Body:

{
   "action": "delete",
   "payload": {
      "id": 29988
   }
}

Success-Response: (HTTP/1.1 200 OK)

{
    "status": "OK"
}

5.3 Get Groups

Success Response

Field Type Description
id Long ID of the group
name String Name of the group
permission Integer Access-permissions of the user on this group.
1 - Read
2 - Read/Write
3 - Owned
4 - Full access
sharedWith JSON[] List of the contacts the group is shared with. See the structure of contact JSON object below.
userId Long ID of the contact
name String Name of the contact
permission Integer Contact's permissions for the group.
1 - Read Only
2 - Read/Write
3 - Owned by user
4 - Full Access
contacts JSON[] List of the contacts in the group. See the structure of contact JSON object below.
id Long ID of the contact
name String Name of the contact
state Integer Availability status of the contact.
0 - Online
1 - Busy
2 - Away
3 - Offline
email String Email of the contact
devices JSON[] List of the devices in the group. See the structure of device JSON object below.
id Long ID that is unique for this device within current user's device list.
tvId Long ID that is unique to this device and can be used to start a remote control session
name String Name that the current user has given to this device

Request-Example:

GET
https://api.teamviewer-iot.com/groups

Success-Response:

{
   "data": [
      {
         "id": 29988,
         "name": "edited",
         "permission": 3,
         "sharedWith": [],
         "devices": [],
         "contacts": []
      },
      {
         "id": 27878,
         "name": "foo",
         "permission": 4,
         "sharedWith": [
            {
               "name": "qaiotdev",
               "permission": 3
            }
         ],
         "devices": [
            {
               "id": 5439,
               "tvId": 2000001130,
               "name": "raspberrypi"
            },
            {
               "id": 597,
               "tvId": 2082190472,
               "name": "qa-iot"
            }
         ],
         "contacts": [
            {
               "id": 6574,
               "name": "qaiotdev",
               "state": 3,
               "email": "qaiotdev@teamviewer.com"
            },
            {
               "id": 5380,
               "name": "test",
               "state": 3,
               "email": "test@teamviewer.com"
            }
            ]
        }
    ]
}

5.4 Update Group

Request Body

Field Type Description
action String update
id Long ID of the group
name
optional
String Name of the group
devices
optional
JSON[] List of device ids in following format
["456931800","678991800"]

Request-Example:

POST
https://api.teamviewer-iot.com/groups

Request-Body:

{
	"action":"update",
	"payload":{
			"id":"29988",
			"name":"edited",
			"devices": ["456931800","678991800"]
	 }
}

Success-Response:

{
    "status": "OK"
}

5.5 Share Group

Request Body

Field Type Description
action String update
id Long ID of the group
contacts JSON[] List of the contacts to share the group with. See the structure of contact JSON object below.
id Integer ID of the contact.
permission Integer Contact's permissions for this group.
1 - Read Only
2 - Read/Write
3 - Owned by user
4 - Full Access

Request-Example:

POST
https://api.teamviewer-iot.com/sharegroup

Request-Body:

{  
   "action":"update",
   "payload":{  
      "id":29988,
      "contacts":[  
         {  
            "id": 24599,
            "permission": 1
         }
      ]
   }
}

Success-Response:

{
    "status": "OK"
}

5.6 Unshare Group

Request Body

Field Type Description
action String update
id Long ID of the group
contacts JSON[] List of contacts to remove from the group's shared contacts list. Use following format
[{"id":24599},{"id":124124}]

Request-Example:

POST
https://api.teamviewer-iot.com/unsharegroup

Request-Body:

{
	"action":"update",
	"payload":{  
       "id":29988,
       "contacts":[  
          {  
             "id":24599
          }
       ]
    }
}

Success-Response:

{
    "status": "OK"
}

6.1 Create Custom Sensor

Use this request to create a custom sensor with any set of metrics. The script for getting metric values must exist on the device. Script path should be provided in the request.

Request Body

Field Type Description
action String create
name String Name of the sensor
frequency JSON value - Data will be sent by this interval. Value should be more than or equal to 1 second
type - This field can have the following values:
  • minutes
  • seconds
deviceId Long ID of the device
scriptPath String Path of a Python or Bash script which prints to console metric id and value pairs in following JSON format.
{"metricId": value}

Predefined value for the opc-ua sensor:
  • /var/lib/teamviewer-iot-agent/scripts/opcua/start.sh
sensorType
optional
Integer
  • 1 - Custom (default)
  • 2 - OPC-UA
metrics JSON[] List of metrics within the sensor. See the structure of metric JSON below.
id String ID of the metric. Should be same as in the output of the script.
name String Name of the metric
valueType String
  • string
  • bool
  • double
valueUnit String Optional field to define a common unit for metric values. Common units are:
  • SI.ElectricCurrent.AMPERE
  • SI.DataAmount.BIT
  • SI.Temperature.CELSIUS
  • SI.ElectricCapacitance.FARAD
  • SI.Mass.GRAM
  • SI.Frequency.HERTZ
  • SI.Energy.JOULE
  • SI.Length.METER
  • SI.Velocity.METERS_PER_SECOND
  • SI.AmountOfSubstance.MOLE
  • SI.Force.NEWTON
  • SI.ElectricResistance.OHM
  • SI.Pressure.PASCAL
  • SI.Angle.RADIAN
  • SI.Duration.SECOND
  • SI.Area.SQUARE_METRE
  • SI.ElectricPotential.VOLT
  • SI.Power.WATT
  • SI.LuminousIntensity.CANDELA
  • SI.Acceleration.METERS_PER_SQUARE_SECOND
  • NoSI.Dimensionless.PERCENT
  • NoSI.Dimensionless.DECIBEL
valueAnnotation String Optional field to define a custom unit for metric values.
params
optional
JSON Now available only for opc-ua sensor.
Parameters for the script. See the structure of param JSON below.
nodeids String Node ids and metric ids mapping separated by the space.
"nodeId1 metricId1 nodeId2 metricId2"
Provide the nodeId as in the example: 'ns=1;s=Folder.Item.Property'.
Metric ids should be the same provided in the metrics array.

Instructions for OPC-UA sensor

TeamViewer IoT Agent has a built in OPC UA client. It can connect to OPC UA Servers and collect node values.
In IoT Cloud "Metric" represents the OPC UA node and "Sensor" groups them.

Install OPC UA connector on the edge device:
sudo teamviewer-iot-agent install opcua

Edit the configuration file according to your OPC UA server settings:
vim /var/lib/teamviewer-iot-agent/scripts/opcua/opcua.conf

Note: Now supporting only one opc-ua sensor per devices.

Request Example

POST
https://api.teamviewer-iot.com/sensors

Request-Body:

{
    "action": "create",
    "payload": {
        "name": "New Sensor",
		"deviceId": 2000565656,
		"scriptPath": "/home/script.py",
        "frequency": {
			"type": "seconds",
			"value": 10
		},
        "metrics": [
            {
                "id": "temp",
                "name": "Temperature",
				"valueType": "double",
                "valueUnit": "SI.Temperature.CELSIUS"
            },
			{
                "id": "vel",
                "name": "Velocity",
				"valueType": "double",
                "valueAnnotation": "km/h"
            },
            {
                "id": "status",
                "name": "Status",
                "valueType": "string"
            }
        ]
    }
}

Success Response: (HTTP/1.1 200 OK)

{
   "data": {
      "id": 486471
   },
   "status": "OK"
}

Request Example for OPC-UA sensor

POST
https://api.teamviewer-iot.com/sensors

Request-Body:

{
    "action": "create",
    "payload": {
      "name": "New opc-ua Sensor",
		"deviceId": 2000565656,
		"scriptPath": "/var/lib/teamviewer-iot-agent/scripts/opcua/start.sh",
      "sensorType":2,
      "frequency": {
			"type": "seconds",
			"value": 10
		},
        "metrics": [
            {
                "id": "temp",
                "name": "Temperature",
				    "valueType": "double",
                "valueUnit": "SI.Temperature.CELSIUS"
            },
			   {
                "id": "vel",
                "name": "Velocity",
				    "valueType": "double",
                "valueAnnotation": "km/h"
            }
        ],
        "params": {
            "nodeids":"'ns=1;s=Folder.Item.Temp' temp 'ns=1;s=Folder.Item.Velocity' vel"
         }
    }
}

Success Response: (HTTP/1.1 200 OK)

{
   "data": {
      "id": 123456
   },
   "status": "OK"
}

6.2 Create System Health Sensor

Use this request to create a CPU, Memory or Load sensors. These sensors measure device health such as cpu and memory usage, load average and more.

Request Body

Field Type Description
action String create
name String Name of the sensor
frequency JSON value - Data will be sent by this interval. Value should be more than or equal to 1 second
type - This field can have the following values:
  • minutes
  • seconds
deviceId Long ID of the device
systemHealthType Integer
  • 1 - CPU
  • 2 - Memory
  • 3 - Load

Request Example

POST
https://api.teamviewer-iot.com/sensors

Request-Body:

{
    "action": "create",
    "payload": {
        "name": "New Sensor",
		"deviceId": 2000565656,
        "frequency": {
			"type": "seconds",
			"value": 10
		},
        "systemHealthType": 1
    }
}

Success Response: (HTTP/1.1 200 OK)

{
   "data": {
      "id": 486471
   },
   "status": "OK"
}

6.3 Delete Sensor

Request Body

Field Type Description
action String delete
id Long ID of the sensor
deviceId Long ID of the device

Request Example

POST
https://api.teamviewer-iot.com/sensors

Request-Body:

{
   "action": "delete",
   "payload": {
      "id": 52342,
      "deviceId": 2000000048   
   }
}

Success Response: (HTTP/1.1 200 OK)

{
    "status": "OK"
 }

6.4 Get Sensors

Success Response

Field Type Description
id Long ID of the Sensor
name String Name of the sensor
provisionedsensorid String ID of the sensor in the scope of device MQTT API)
device JSON Device info that sensor belongs to.
id - Id of the device
name - Name of the device

Request Example:

GET
https://api.teamviewer-iot.com/sensors

Success Response: (HTTP/1.1 200 OK)

{
   "data": [
      {
         "name": "unispeed61507279058",
         "id": 8807,
         "provisionedsensorid": "8cb243947fa24675a7495f26a917d557",
         "device": {
            "name": "Device_1",
            "id": 2000001925
         }
      },
      {
         "name": "New Sensor",
         "id": 486471,
         "provisionedsensorid": "486471",
         "device": {
            "name": "Device_2",
            "id": 2000565656
         }
      }
   ],
   "status": "OK"
}

6.5 Update Sensor

Request Body

Field Type Description
action String update
id Long ID of the sensor
frequency JSON value - Data will be sent by this interval. Value should be more than or equal to 0 second
type - This field can have the following values:
  • minutes
  • seconds
scriptPath String Path of a Python or Bash script which prints to console metric id and value pairs in following JSON format.
{"metricId": value}

Predefined value for the opc-ua sensor:
  • /var/lib/teamviewer-iot-agent/scripts/opcua/start.sh
sensorType
optional
Integer
  • 1 - Custom (default)
  • 2 - OPC-UA
metrics JSON[] List of metrics within the sensor. See the structure of metric JSON below.
id String ID of the metric. Should be same as in the output of the script.
name String Name of the metric
valueType String
  • string
  • bool
  • double
valueUnit String Optional field to define predefined unit for metric values. Metric type will be a double in case of these units. Predefined valid units are:
  • SI.ElectricCurrent.AMPERE
  • SI.DataAmount.BIT
  • SI.Temperature.CELSIUS
  • SI.ElectricCapacitance.FARAD
  • SI.Mass.GRAM
  • SI.Frequency.HERTZ
  • SI.Energy.JOULE
  • SI.Length.METER
  • SI.Velocity.METERS_PER_SECOND
  • SI.AmountOfSubstance.MOLE
  • SI.Force.NEWTON
  • SI.ElectricResistance.OHM
  • SI.Pressure.PASCAL
  • SI.Angle.RADIAN
  • SI.Duration.SECOND
  • SI.Area.SQUARE_METRE
  • SI.ElectricPotential.VOLT
  • SI.Power.WATT
  • SI.LuminousIntensity.CANDELA
  • SI.Acceleration.METERS_PER_SQUARE_SECOND
  • NoSI.Dimensionless.PERCENT
  • NoSI.Dimensionless.DECIBEL
valueAnnotation String Optional field to define a custom unit for metric values.
params
optional
JSON Now available only for opc-ua sensor.
Parameters for the script. See the structure of param JSON below.
nodeids String Node ids and metric ids mapping separated by the space.
"nodeId1 metricId1 nodeId2 metricId2"
Provide the nodeId as in the example: 'ns=1;s=Folder.Item.Property'.
Metric ids should be the same provided in the metrics array.

Request Example

POST
https://api.teamviewer-iot.com/sensors

Request-Body:

{
    "action": "update",
    "payload": {
        "id": 486471,
        "name": "Updating Sensor",
        "frequency": {
			"type": "seconds",
			"value": 5
		},
        "metrics": [
            {
                "id": "temperature3",
                "name": "Temperature 3",
                "valueType": "double",
                "valueAnnotation": "C"
            }
        ],
        "scriptPath": "/home/script.py"
    }
}

Success Response: (HTTP/1.1 200 OK)

{
   "data": {
      "id": 486471
   },
   "status": "OK"
}

Request Example:

GET
https://api.teamviewer-iot.com/sensors?grouping=count

Success Response: (HTTP/1.1 200 OK)

{
   "data": [3],
   "status": "OK"
}

7.1 Get Metrics

Success Response

Field Type Description
id String ID of the metric
name String Name of the metric
valueUnit String One of the common unit of measures set for the metric, e.g. Celsius, Pascal, etc.
valueAnnotation String Custom unit of measure set for the metric.
valueType String Data type of the metric.
  • bool
  • string
  • double
  • integer
sensor JSON Sensor to which the metric belongs. See the structure of sensor JSON object below.
id Long Id of the sensor
name String Name of the sensor
device JSON Device to which the metric belongs. See the structure of device JSON object below.
id Long Id of the device
name String Name of the device

Request-Example:

GET
https://api.teamviewer-iot.com/metrics

Success-Response: (HTTP/1.1 200 OK)

{
   "data": {
      "metrics": [
         {
            "id": "9ba3790e5dd0417cb87264a08f7a5b41",
            "name": "Temperature-1",
            "valueunit": "NoSI.Dimensionless.PERCENT",
            "valuetype": "double",
            "sensor": {
               "id": 84391,
               "name": "Thermometer-1-Floor-3B",
            },
            "device": {
               "name": "IoT Gateway 1",
               "id": 2012085255
            }
         }
      ]
   },
   "status": "OK"
}

Request-Example:

GET
https://api.teamviewer-iot.com/metrics?grouping=count

Success-Response: (HTTP/1.1 200 OK)

{
   "data": {
      "metrics": [30]
   },
   "status": "OK"
}

Request-Example:

GET
https://api.teamviewer-iot.com/metrics?grouping=count

Success-Response: (HTTP/1.1 200 OK)

{
   "data": {
      "metrics": [],
      "deviceCount": 3
   },
   "status": "OK"
}

8.1 Create Rule

Request Body

Field Type Description
action String create
name String The name of the Rule
ruleType Integer 1 - Rule related to metric values
2 - Rule related to device offline status
sources JSON[] List of devices or metrics. See the structure of source JSON below.
metricId String ID of the metric
thingId Integer ID of the thing/sensor
deviceId Long ID of the device
thresholds JSON[] List of thresholds. See the structure of threshold JSON below.
condition String Possible values
  • metric < | <= | == | != | > | >= number
    alarm will be generated when given boolean expression is true
  • missing=$numberOfmin
    numberOfmin is a number between 1 and 300. Alarm will be generated if metric value is not updated for duration of given minutes
  • number beetween 1 and 300
    Alarm will be generated if device is offline for given amount of minutes.
  • 0
    Alarm will be immediately generated when device goes offline
severity Integer
  • 1 - Critical
  • 2 - Major
  • 3 - Minor
  • 4 - Warning
checkcount Integer Number of consecutive checks required to trigger an alarm
topicIds JSON[] Array of existing topic ids
newTopics JSON[] Array of new topic names

Request Example

POST
https://api.teamviewer-iot.com/rules

Request-Body:

{
   "action": "create",
   "payload": {
      "name": "rule1",
      "ruleType": 1,
      "sources": [
         {
            "metricId": "6b1c072371104611961eca76d413528a",
            "thingId": 96275
         }
      ],
      "thresholds": [
         {
            "condition": "metric==1",
            "severity": 1,
            "topicIds": [
               "331c072371546611961eca76d413aa8a",
               "aaa37237b1546611961eca16d413ab9a"
            ],
            "newTopics": [
               "New load topic",
               "Second topic"
            ],
            "checkcount": 1
         }
      ]
   }
}

Success Response: (HTTP/1.1 200 OK)

{
   "data": {
      "id": "5c40273ee27d3c716847f530"
   },
   "status": "OK"
}

8.2 Delete Rules

Request Parameters

Field Type Description
action String delete
id String[] List of rule IDs

Request Example

POST
https://api.teamviewer-iot.com/rules

Request-Body:

{
	"action": "delete",
	"payload": {
		"id": ["5c40273ee27d3c716847f530", ...]
	}
}

Success Response: (HTTP/1.1 200 OK)

{
   "status": "OK"
}

8.3 Get Rules

Success Response

Field Type Description
id String ID of the rule
name String Name of the rule
ruleType Integer 1 - Rule related to metric values
2 - Rule related to device offline status
activeflag Integer 1 - Active rule
2 - Disabled rule
sources JSON[] List of devices or metrics. See the structure of source JSON below.
metricId String ID of the metric
thingId Integer ID of the thing/sensor
deviceId Long ID of the device
thresholds JSON[] List of thresholds. See the structure of threshold JSON below.
condition String Possible values
  • metric < | <= | == | != | > | >= number
    alarm will be generated when given boolean expression is true
  • missing=$numberOfmin
    numberOfmin is a number between 1 and 300. Alarm will be generated if metric value is not updated for duration of given minutes
  • number beetween 1 and 300
    Alarm will be generated if device is offline for given amount of minutes.
  • 0
    Alarm will be immediately generated when device goes offline
severity Integer
  • 1 - Critical
  • 2 - Major
  • 3 - Minor
  • 4 - Warning
checkcount Integer Number of consecutive checks required to trigger an alarm
topicIds JSON[] Array of existing topic ids
newTopics JSON[] Array of new topic names

Request Example:

GET
https://api.teamviewer-iot.com/rules

Success Response: (HTTP/1.1 200 OK)

{
   "data": [
      {
         "id": "5d52a6e5e27d3b7b484fe2a8",
         "name": "Detect Machine Overheating",
         "ruletype": 1,
         "activeflag": 1,
         "thresholds": [
            {
               "severity": 1,
               "condition": "metric>=60",
               "checkcount": 1
            }
         ],
         "sources": [
            {
               "devicename": "CNC-Manifest-Floor1-SC1",
               "sensorname": "Load",
               "metricid": "38aca994a6764e5c8c7819c6e774f505",
               "metricname": "1 min load",
               "thingid": 82331
            },
            {
               "devicename": "CNC-Manifest-Floor1-SC2",
               "sensorname": "CPU",
               "metricid": "ca2d8983375d47beb1af9a9d8ac21e36",
               "metricname": "Nice CPU Usage",
               "thingid": 54126
            }
         ]
      },
      {
         "id": "5d316ebee27d3b2ac5491d45",
         "name": "Offline done",
         "ruletype": 2,
         "activeflag": 1,
         "thresholds": [
            {
               "severity": 1,
               "condition": "22",
               "checkcount": 1
            }
         ],
         "sources": [
            {
               "deviceid": 2022634333,
               "devicename": "vagrant-ubuntu-trusty-64"
            }
         ]
      }
   ],
   "status": "OK"
}

8.4 Update Rule

Request Body

Field Type Description
action String update
id String ID of the rule
name
optional
String The name of the Rule
activeflag Integer 1 - Activate rule
2 - Disable rule
sources optional JSON[] List of devices or metrics. See the structure of source JSON below.
metricId String ID of the metric
thingId Integer ID of the thing/sensor
deviceId Long ID of the device
thresholds optional JSON[] List of thresholds. See the structure of threshold JSON below.
condition String Possible values
  • metric < | <= | == | != | > | >= number
    alarm will be generated when given boolean expression is true
  • missing=$numberOfmin
    numberOfmin is a number between 1 and 300. Alarm will be generated if metric value is not updated for duration of given minutes
  • number beetween 1 and 300
    Alarm will be generated if device is offline for given amount of minutes.
  • 0
    Alarm will be immediately generated when device goes offline
severity Integer
  • 1 - Critical
  • 2 - Major
  • 3 - Minor
  • 4 - Warning
checkcount Integer Number of consecutive checks required to trigger an alarm
topicIds JSON[] Array of existing topic ids
newTopics JSON[] Array of new topic names

Request Example:

POST
https://api.teamviewer-iot.com/rules

Request-Body:

{
   "action": "update",
   "payload": {
      "id": "1c3a4acbe27d3b13ff2dc031",
      "name": "CNC-1 Overheating",
      "activeflag": 1,
      "sources": [
         {
            "metricId": "b6dd1abbeb1d2cb1b9d62603f3d30bd3",
            "thingId": 13892
         }
      ],
      "thresholds": [
         {
            "condition": "metric>41",
            "severity": 2,
            "topicIds": [
               "5c403922e27d3b78c517f51a"
            ],
            "checkcount": 1
         }
      ]
   }
}

Success Response: (HTTP/1.1 200 OK)

{
   "data": {
      "id": "5c40273ee27d3c716847f530"
   },
   "status": "OK"
}

9.1 Get Alarms

Request Parameters

Field Type Description
range [startTimestamp, endTimestamp] startTimestamp - Epoch time of the time range start.
endTimestamp - Epoch time of the time range end
status Integer 1 - Open alarms
3 - Closed alarms

Request-Example:

GET
https://api.teamviewer-iot.com/alarms?range=[1542781312725,1545373312725]&status=1

Success-Response: (HTTP/1.1 200 OK)

{
   "data": [
      {
         "severity": "1",
         "changeLog": [],
         "description": "rule1",
         "source": {
            "sourceKey": "2018301694_1111_2222",
            "details": {
               "sensor": "Memory",
               "consCheck": "1",
               "condition": "metric>0",
               "value": "15",
               "device": "RevPi1",
               "metric": "Free Memory"
            },
            "id": "5c19dae2336bc71e230db72a"
         },
         "id": "5ea165ef-3d66-407c-82b5-15062a35d89d",
         "type": "1",
         "openTime": 1545292817957,
         "status": "1"
      }
   ],
   "status": "OK"
}

Request-Example:

GET
https://api.teamviewer-iot.com/alarms?range=[1542781312725,1545373312725]&status=1

Success-Response: (HTTP/1.1 200 OK)

{
   "data": [
      {
         "severity": "1",
         "changeLog": [],
         "description": "device_rule1",
         "source": {
            "sourceKey": "2018301694",
            "details": {
               "device": "RevPi1",
               "offlineDuration": "15"
            },
            "id": "5c19dae2336bc71e230db72a"
         },
         "id": "5ea165ef-3d66-407c-82b5-15062a35d89d",
         "type": "2",
         "openTime": 1545284319471,
         "status": "1"
      }
   ],
   "status": "OK"
}

Request-Example:

GET
https://api.teamviewer-iot.com/alarms?range=[1542781312725,1545373312725]&status=3

Success-Response: (HTTP/1.1 200 OK)

{
   "data": [
      {
         "severity": "1",
         "changeLog": [
            {
               "closeTime": 1545284319571,
               "userId": "u111",
               "prevVal": "Open",
               "currentVal": "Closed By System",
               "prop": "status"
            }
         ],
         "description": "metric rule",
         "source": {
            "sourceKey": "2018301694_1111_2222",
            "details": {
               "sensor": "Memory",
               "consCheck": "1",
               "condition": "metric>10",
               "value": "5",
               "device": "RevPi1",
               "metric": "Free Memory"
            },
            "id": "5c19dae2336bc71e230db72a"
         },
         "id": "5ea165ef-3d66-407c-82b5-15062a35d89d",
         "type": "1",
         "openTime": 1545284319471,
         "status": "3"
      }
   ],
   "status": "OK"
}

9.2 Close Alarm

Request Body

Field Type Description
action String close
id String ID of the alarm

Request-Example:

POST
https://api.teamviewer-iot.com/alarms

Request-Body:

{
   "action": "close",
   "payload": {
      "id": "745ea3cb-fc67-49ec-9352-287f072c9f10"
   }
}

Success-Response: (HTTP/1.1 200 OK)

{
   "data": {
      "changelog": {
         "closetime": 1550736334329,
         "userid": "u111",
         "prevval": "Open",
         "currentval": "Closed By User",
         "prop": "status"
      },
      "id": "745ea3cb-fc67-49ec-9352-287f072c9f10",
      "userid": "u111",
      "opentime": 1550736264995,
      "status": 3
   },
   "status": "OK"
}

10.1 Create Topic

Request Body

Field Type Description
action String create
name String The name of the Topic
channels
optional
String[] The array of channels' ids subscribing to the Topic

Request Example

POST
https://api.teamviewer-iot.com/topics

Request-Body:

{
   "action": "create",
   "payload": {
      "name": "New Topic",
      "channels": [
         "5d498a5a965e59417cb3cf36"
      ]
   }
}

Success Response: (HTTP/1.1 200 OK)

{
   "data": {
      "id": "5d4ab2b3d4f99c207961a15d"
   },
   "status": "OK"
}

10.2 Delete Topic

Request Body

Field Type Description
action String delete
id String ID of the topic

Request Example

POST
https://api.teamviewer-iot.com/topics

Request-Body:

{
   "action": "delete",
   "payload": {
      "id": "5d4ab2b3d4f99c207961a15d"
   }
}

Success Response: (HTTP/1.1 200 OK)

{
   "status": "OK"
}

10.3 Get Topics

Success Response

Field Type Description
id String ID of the topic
name String Name of the topic
channels JSON[] List of channels subscribed to the topic.

Request Example:

GET
https://api.teamviewer-iot.com/topics

Success Response: (HTTP/1.1 200 OK)

{
   "data": [
      {
         "name": "Memory topic",
         "id": "5d4838c0931d9a3214f399b6",
         "channels": [
            {
               "name": "The second channel",
               "id": "5d4838c0931d9a3214f399b5",
               "target": "iot-agent@teamviewer.com"
            }
         ]
      },
      {
         "name": "CPU topic",
         "id": "5d483930931d9a3214f399b7"
      }
   ]
}

10.4 Update Topic

Request Body

Field Type Description
action String update
id String ID of the topic
name String Name of the topic
channels
optional
String[] The array of channels' ids subscribing to the Topic

Request Example:

POST
https://api.teamviewer-iot.com/topics

Request-Body:

{
   "action": "update",
   "payload": {
      "id": "5d483827931d9a3214f399b4",
      "name": "CPU overload",
      "channels": [
         "5d498a5a965e59417cb3cf36"
      ]
   }
}

Success Response: (HTTP/1.1 200 OK)

{
   "data": {
      "id": "5d483827931d9a3214f399b4"
   },
   "status": "OK"
}

11.1 Create Channel

Request Body

Field Type Description
action String create
name String Channel name
type Integer 0 - Email channel
1 - Webhook channel
target String Email address or webhook URL
timeZoneId String Time zone string (GMT+02:00 Europe/Berlin)
topicInfos
optional
JSON[] Array of existing topic ids
newTopics
optional
JSON[] Array of new topic names

Request Example

POST
https://api.teamviewer-iot.com/channels

Request-Body:

{
   "action": "create",
   "payload": {
      "name": "New channel",
      "type": 0,
      "target": "john.mayer@gmail.com",
      "timeZoneId": "GMT+02:00 Europe/Berlin",
      "topicInfos": [
         "5d483930931d9a3214f399b7"
      ],
      "newTopics": [
         "Topic 5",
         "Email topic"
      ]
   }
}

Success Response: (HTTP/1.1 200 OK)

{
   "data": {
      "id": "5d4ac2eed4f99c207961a162"
   },
   "status": "OK"
}

11.2 Delete Channel

Request Body

Field Type Description
action String delete
id String ID of the channel

Request Example

POST
https://api.teamviewer-iot.com/channels

Request-Body:

{
   "action": "delete",
   "payload": {
      "id": "5d483930931d9a3214f399b7"
   }
}

Success Response: (HTTP/1.1 200 OK)

{
   "status": "OK"
}

11.3 Get Channels

Success Response

Field Type Description
id Long ID of the channel
name String Name of the channel
type Integer 0 - Email channel
1 - Webhook channel
activeflag Integer 1 - Active channel
2 - Disabled channel
3 - Unconfirmed channel
timezone JSON name - Country/Region
offset - Time difference from UTC
topicInfos JSON[] List of topics assigned to the channel
id - Topic ID
name - Topic name
target String Email address or webhook URL

Request Example:

GET
https://api.teamviewer-iot.com/channels

Success Response: (HTTP/1.1 200 OK)

{
   "data": [
      {
         "id": "5d4ac2eed4f99c207961a162",
         "name": "Channel 7",
         "type": 1,
         "activeflag": 3,
         "timezone": {
            "name": "Europe/Berlin",
            "offset": "GMT+02:00"
         },
         "topicinfos": [
            {
               "id": "5d483930931d9a3214f399b7",
               "name": "Load topic"
            }
         ],
         "target": "https://webhook.site/95c4aac2-0e69-4b55-8fb5-7e4717dd3a81"
      }
   ],
   "status": "OK"
}

11.4 Update Channel

Request Body

Field Type Description
action String update
id Long ID of the channel
name String Name of the channel
target String Email address or webhook URL
timeZoneId
optional
String Time zone string (GMT+02:00 Europe/Berlin)
topicInfos
optional
JSON[] Array of existing topics ids.
newTopics
optional
JSON[] Array of new topics names.
activeflag
optional
Integer 1 - Activate channel
2 - Disable channel

Request Example:

POST
https://api.teamviewer-iot.com/channels

Request-Body:

{
   "action": "update",
   "payload": {
      "id": "5d4ac2eed4f99c207961a162",
      "name": "updating the channel",
      "target": "https://webhook.site/95c4aac2-0e69-4b55-8fb5-7e4717dd3a81",
      "timeZoneId": "GMT+02:00 Europe/Berlin",
      "topicInfos": [
         "5d483930931d9a3214f399b7"
      ],
      "newTopics": [
         "Webhook topic"
      ],
      "activeflag": 2
   }
}

Success Response: (HTTP/1.1 200 OK)

{
   "data": {
      "id": "5d4ac2eed4f99c207961a162"
   },
   "status": "OK"
}

12.1 Create Dashboard

Request Body

Field Type Description
action String create
name String Dashboard name

Request-Example:

POST
https://api.teamviewer-iot.com/dashboards

Request-Body:

{
   "action": "create",
   "payload": {
      "name": "Load Dashboard"
   }
}

Success-Response: (HTTP/1.1 200 OK)

{
   "data": {
      "name": "Load Dashboard",
      "id": "5c46c87e9cd2501c5ea361b1"
   },
   "status": "OK"
}

12.2 Delete Dashboard

Request Body

Field Type Description
action String delete
id String ID of the dashboard

Request-Example:

POST
https://api.teamviewer-iot.com/dashboards

Request-Body:

{
   "action": "delete",
   "payload": {
      "id": "5c46c87e9cd2501c5ea361b1"
   }
}

Success-Response: (HTTP/1.1 200 OK)

{
   "status": "OK"
}

12.3 Get All Dashboards

GET
https://api.teamviewer-iot.com/dashboards

Success-Response:

 {
    "data": [
       {
          "name": "Dashboard 2",
          "id": "5c46c6d09cd25017f115a7d9"
       },
       {
          "name": "Load Dashboard",
          "id": "5c46c87e9cd2501c5ea361b1"
       },
       {
          "name": "CPU dash. -  5th room",
          "id": "5c4b1c7b9cd2502c5a1d5562"
       }
    ],
    "status": "OK"
 }

12.4 Get A Dashboard

Request Parameters

Field Type Description
id String ID of the dashboard
GET
https://api.teamviewer-iot.com/dashboards?id=5a8d2efb336bc740e5a08139

Success-Response: (HTTP/1.1 200 OK)

{
   "data": {
      "id": "5c46c87e9cd2501c5ea361b1",
      "name": "Dashboard!",
      "widgets": [
         {
            "name": "My Widget",
            "layout": {
               "width": 4,
               "height": 6,
               "positionx": "4",
               "positiony": "0",
               "widgetid": "5e5f5434a7287b0a4573be6a"
            },
            "settings": {
               "dataperiod": 1,
               "limit": 900,
               "aggregation": {
                  "method": "AVG",
                  "period": 1000
               },
               "refreshInterval": 60000
            },
            "id": "5e5f5434a7287b0a4573be6a",
            "metrics": [
               {
                  "name": "My Metric",
                  "uom": "NoSI.Dimensionless.PERCENT",
                  "sensor": {
					"name": "R1",
					"beehivename": "raspberrypi",
					"id": 110811,
					"provisionedsensorid": "94b7e17f127143fdb13a876969aff857"
				  },
                  "id": "b7f0afa8594c4c1bb8a7bb1aefccf6af"
               }
            ],
            "type": "1"
         }
      ]
   },
   "status": "OK"
}

12.5 Update Dashboard

Request Body

Field Type Description
action String update
id String ID of the dashboard
name String Name of the dashboard

Request-Example:

POST
https://api.teamviewer-iot.com/dashboards

Request-Body:

{
   "action": "update",
   "payload": {
      "name": "CPU dash. -  5th room",
      "id": "5c4b1c7b9cd2502c5a1d5562"
   }
}

Success-Response:

{
   "data": {
      "name": "CPU dash. -  5th room",
      "id": "5c4b1c7b9cd2502c5a1d5562"
   },
   "status": "OK"
}

13.1 Create Widget

Request Body

Field Type Description
action String create
dashboardId String ID of the dashboard.
name String Name of the widget
type Number Type of the widget
1 - Chart
2 - Number
7 - Gauge
8 - Thermometer
9 - Map
10 - String
11 - Status Indicator
metrics JSON[] id - Metric id
sensor - Sensor id with format { "id": 96314 }
layout
optional
JSON Size and position of the widget in the dashboard. For more information check "Layout properties" part.
settings
optional
JSON Settings for the widget. For more information check "Setting properties" part.

Layout properties optional

Dashboard using grid layout with the sizes 10x and 20y to position the widgets. x and y will be calculated automatically based on browser size. All properties below using the grid units, not pixels. Only integer numbers should be provided here.

Field Type Description
width Number Width of the widget
Default value - 2, for chart and map types - 4
height Number Height of the widget
Default value - 6
positionX String Position of the left-top point of the widget in the dashboard's x-axis
positionY String Position of the left-top point of the widget in the dashboard's y-axis

Setting properties optional

Field Type Description
dataPeriod Number Data request period for the widget.
1 - Live (default)
2 - Last 5 min.
3 - Last 15 min.
4 - Last 30 min.
5 - Last 1 hour
6 - Last 6 hours
7 - Last 12 hours
8 - Last 1 day
9 - Last 1 week
10 - Last 1 month
aggregation JSON Aggregation properties.

method - Aggregation function
MIN
MAX
AVG(default)
STDEV
COUNT
period - Aggregation time period in ms
refreshInterval Number Widget refresh frequency in ms

Request-Example:

POST
https://api.teamviewer-iot.com/widgets

Request-Body:

{
   "action": "create",
   "payload": {
      "dashboardId": "5c5af70fb0e37d00056d25ea",
      "name":"Number Widget",
      "type": 2,
      "metrics": [
         {
            "sensor": {
               "id": 96314
            },
            "id": "2a4664fef3344d5f919b59832d304dbf"
         }
      ], 
      "layout": {
           "width": 2, 
           "height": 6
        }
   }
}

Success-Response: (HTTP/1.1 200 OK)

{
   "status": "OK"
}

Request-Example:

POST
https://api.teamviewer-iot.com/widgets

 

{
   "action": "create",
   "payload": {
      "dashboardId": "5c5af70fb0e37d00056d25ea",
      "name":"String Widget",
      "type": 10,
      "metrics": [
         {
            "sensor": {
               "id": 96314
            },
            "id": "2a4664fef3344d5f919b59832d304dbf"
         }
      ]
   }
}

Success-Response: (HTTP/1.1 200 OK)

{
   "status": "OK"
}

Request-Example:

POST
https://api.teamviewer-iot.com/widgets

 

{
   "action": "create",
   "payload": {
      "dashboardId": "5c5af70fb0e37d00056d25ea",
      "name":"Status Indicator Widget",
      "type": 11,
      "metrics": [
         {
            "sensor": {
               "id": 66314
            },
            "id": "3a4664fef3344d5f919b59832d304dbe"
         }
      ]
   }
}

Success-Response: (HTTP/1.1 200 OK)

{
   "status": "OK"
}

13.1.1 Chart Widget

Chart Widget Settings

Field Type Description
axisType
optional
Number 1 - Single axis (default)
2 - Multiple axis

Multiple axis available only for multiple metrics.
scalingType
optional
Number 1 - Autoscaling (default)
2 - Manual

Manual scaling type available only for single axis
minValue String Minimum value for the y-axis in case of manual scaling type
maxValue String Maximum value for the y-axis in case of manual scaling type

Request-Example:

POST
https://api.teamviewer-iot.com/widgets

 

{
   "action": "create",
   "payload": {
      "dashboardId": "5c5af70fb0e37d00056d25ea",
      "name":"Chart Widget",
      "type": 1,
      "metrics": [
         {
            "sensor": {
               "id": 96314
            },
            "id": "2a4664fef3344d5f919b59832d304dbf"
         }
      ], 
      "settings": {
          "axisType": 1,
          "scalingType": 2,
          "minValue": "0",
          "maxValue": "30"
      }
   }
}

Success-Response: (HTTP/1.1 200 OK)

{
   "status": "OK"
}

13.1.2 Gauge Widget

Gauge Widget Settings

Field Type Description
minValue String Minimum value for the gauge
maxValue String Maximum value for the gauge

Request-Example:

POST
https://api.teamviewer-iot.com/widgets

 

{
   "action": "create",
   "payload": {
      "dashboardId": "5c5af70fb0e37d00056d25ea",
      "name":"Gauge Widget",
      "type": 7,
      "metrics": [
         {
            "sensor": {
               "id": 96314
            },
            "id": "2a4664fef3344d5f919b59832d304dbf"
         }
      ], 
      "settings": {
          "minValue": "0",
          "maxValue": "90"
      }
   }
}

Success-Response: (HTTP/1.1 200 OK)

{
   "status": "OK"
}

13.1.3 Thermometer Widget

Thermometer Widget Settings

Field Type Description
minValue String Minimum value for the thermometer
maxValue String Maximum value for the thermometer
unit
optional
Number 1 - Celsius (default)
2 - Fahrenheit

Value unit for the thmermometer

Request-Example:

POST
https://api.teamviewer-iot.com/widgets

 

{
   "action": "create",
   "payload": {
      "dashboardId": "5c5af70fb0e37d00056d25ea",
      "name":"Thermometer Widget",
      "type": 8,
      "metrics": [
         {
            "sensor": {
               "id": 96314
            },
            "id": "2a4664fef3344d5f919b59832d304dbf"
         }
      ], 
      "settings": {
          "minValue": "0",
          "maxValue": "90",
          "unit": 1
      }
   }
}

Success-Response: (HTTP/1.1 200 OK)

{
   "status": "OK"
}

13.1.4 Map Widget

Map Widget Settings

Field Type Description
lng String thingId_metricId pair of the metric that will receive location's longtitude
lat String thingId_metricId pair of the metric that will receive location's latitude

Request-Example:

POST
https://api.teamviewer-iot.com/widgets

 

{
   "action": "create",
   "payload": {
      "dashboardId": "5c5af70fb0e37d00056d25ea",
      "name":"Map Widget",
      "type": 9,
      "oneWidgetPerMetric":"0",
      "metrics": [
         {
            "sensor": {
               "id": 96314
            },
            "id": "2a4664fef3344d5f919b59832d304dbf"
         },
         {
            "sensor": {
               "id": 96314
            },
            "id": "3e4665yklf344d5f919b59832d304ccd"
         }
      ], 
      "settings": {
          "lng": "96314_2a4664fef3344d5f919b59832d304dbf",
          "lat": "96314_3e4665yklf344d5f919b59832d304ccd"
      }
   }
}

Success-Response: (HTTP/1.1 200 OK)

{
   "status": "OK"
}

13.2 Delete Widget

Request Body

Field Type Description
action String delete
id String ID of the widget
dashboardId String ID of the dashboard

Request-Example:

POST
https://api.teamviewer-iot.com/widgets

Request-Body:

{
    "action": "delete",
    "payload": {
        "dashboardId": "5a8d2efb336bc740e5a08139",
        "id": "1234365657554353"
    }
}

Success-Response: (HTTP/1.1 200 OK)

{
   "status": "OK"
}

12.3 Update Widget

Request Body

Field Type Description
action String update
id String ID of the widget
dashboardId String ID of the dashboard
name
optional
String Widget name
type
optional
String Widget type

Request-Example:

POST
https://api.teamviewer-iot.com/widgets

Request-Body:

{
    "action": "update",
    "payload": {
        "name": "CPU2",
        "id": "1507105642373",
        "dashboardId" : "5a8d2efb336bc740e5a08139"
    }
}

Success-Response: (HTTP/1.1 200 OK)

{
   "status": "OK"
}

14.1 Get Data

Returns time series data of metrics. Data aggregation is also available.

Request Parameters

Field Type Description
range [startTimestamp, endTimestamp] startTimestamp - Epoch time of the time range start.
endTimestamp - Epoch time of the time range end
period
optional
Long Data aggregation period in ms.
E.g. to get hourly aggreated data period should be set to 3600000
If the period is not set, data will not be aggregated.
metrics JSON[] List of metrics to retrieve data for. See the structure of metric JSON below.
sensorId Long ID of the sensor the metric belongs to
metricId optional String If metricId is not set, data for all metrics of the sensor will be received
func optional String Data aggregation function.
Meaningful only if period parameter is set.
  • MIN
  • MAX
  • AVG (default)
  • STDEV
  • COUNT

Request-Example:

GET
https://api.teamviewer-iot.com/data?range=[1574679580889,1574683180889]&metrics=[{"sensorId":106624,"metricId":"9414e8d582e64e6ead90b549cc4173ef","func":"AVG"}]&period=60000

Success-Response: (HTTP/1.1 200 OK)

{
    "data": [
        {
            "result": [
                {"value": 0, "timestamp": 1574679580889},
                {"value": 0, "timestamp": 1574679640889}
            ],
            "metricId": "9414e8d582e64e6ead90b549cc4173ef",
            "func": "AVG",
            "sensorId": 106624
        }
    ],
    "status": "OK"
}

14.2 Get Last Data

Returns last values of metrics/sensors specified in request.

Request Parameters

Field Type Description
sensorids Long[] List of sensor IDs to retrieve data for.

Request-Example:

GET
https://api.teamviewer-iot.com/snapshot?sensorids=[number,...]

Success-Response: (HTTP/1.1 200 OK)

{
    "data": [
        {
            "temp": "49",
            "sensorId": 811617,
            "timestamp": 1549968244542
        },
        {
            "humidity": "33",
            "sensorId": 8262216,
            "timestamp": 1549968244304
        }
    ]
}

15.1 Create Device Configuration Deprecated

Request Body

Field Type Description
action String create
name String The name of the device configuration.
configuration JSON[] List of configurable entities. See the structure of configuration JSON object below.
key String Name of the configurable entity. Possible values are:
  • edge-management
  • edge-module
    value JSON[] Details of the configurable entity.
    For concrete JSON structure check Edge Module Settings and Edge Management Settings sections.
    enforce boolean If set to true the configuration parameters will be enforced on the device.


    Edge Module Settings

    For Edge Module the value field is a list of edge module ids.



    Edge Management Settings

    Field Type Description
    key String enable
    value Boolean Possible values are
    • true
    • false

    Request-Example:

    POST
    https://api.teamviewer-iot.com/deviceconfiguration

    Request-Body:

    {
      "action": "create",
      "payload": {
        "name": "device configuration for edge-management",
        "configuration": [
          {
            "key": "edge-management",
            "value": [
              {
                "key": "enable",
                "value": true
              }
            ],
            "enforce": true
          },
          {
            "key": "edge-module",
            "value": [
    			"8a2901fa-ec4f-4642-be14-47a571232eac",
    			"4b5601fa-ec4f-4656-ce14-46b571255eac"
    		],
            "enforce": true
          }
        ]
      }
    }

    Success-Response: (HTTP/1.1 200 OK)

    {
    	"data": {
    		"id": "6a2911fa-ec4f-4642-be14-47a571232eab"
    	},
    	"status": "OK"
    }

    15.2 Update Device Configuration Deprecated

    Request Body

    Field Type Description
    action String update
    id String ID of the device configuration
    name String Name of the device configuration
    configuration JSON[] List of configirable entities. See the structure of configuration JSON object below.
    key String Name of the configurable entity. Possible values are:
    • edge-management
    • edge-module
      value JSON[] Details of the configurable entity.
      For concrete JSON structure check Edge Module Settings and Edge Management Settings sections.
      enforce boolean If set to true the configuration parameters will be enforced on the device.

      Request-Example:

      POST
      https://api.teamviewer-iot.com/deviceconfiguration

       

      {
          "action": "UPDATE",
          "payload": {
              "name" : "Updated device configuration",
              "id": "d281543-c6d7-49c7-89c7-03698598b39a",
      		"configuration": [
      		  {
      			"key": "edge-management",
      			"value": [
      			  {
      				"key": "enable",
      				"value": true
      			  }
      			],
      			"enforce": true
      		  },
      		  {
      			"key": "edge-module",
      			"value": [
      					"8a2901fa-ec4f-4642-be14-47a571232eac",
      					"4b5601fa-ec4f-4656-ce14-46b571255eac"
      				],
      			"enforce": true
      		  }
      		]
      	}
      }

      Success-Response: (HTTP/1.1 200 OK)

      {
          "data": {},
          "status": "OK",
          "timestamp": 1566915515424
      }

      15.3 Delete Device Configuration Deprecated

      Request Body

      Field Type Description
      action String delete
      id String ID of the device configuration
      POST
      https://api.teamviewer-iot.com/deviceconfiguration

      Request-Body:

      {
      	"action": "delete",
      	"payload": {
      		"id": "6a2911fa-ec4f-4642-be14-47a571232eab"
      	}
      }

      Success-Response: (HTTP/1.1 200 OK)

      {
      	"status": "OK"
      }

      15.4 Get Device Configurations Deprecated

      Success Response

      Field Type Description
      id String ID of the device configuration
      name String Device configuration name
      configuration JSON[] List of configurable entities. See the structure of configuration JSON object below.
      key String Name of the configurable entity. Possible values are:
      • edge-management
      • edge-module
        value JSON[] Details of the configurable entity.
        For concrete JSON structure check Edge Module Settings and Edge Management Settings sections.
        enforce boolean If set to true the configuration parameters will be enforced on the device.
        assignments JSON[] List of devices and groups that this device configuration is assigned to.
        deviceIds JSON[] The list of assigned device ids in following format
        ["deviceid1","deviceid2"].

        The list of group ids in following format
        ["groupid1","groupid2"]


        Edge Module Settings

        Field Type Description
        edgeModuleId String ID of the IoT Edge Module
        name String Edge Module Name
        repository JSON For details check Edge Module Repository Properties section.
        containerOptions optional JSON For details check Edge Module Container Options section.
        GET
        https://api.teamviewer-iot.com/deviceconfiguration

        Success-Response: (HTTP/1.1 200 OK)

        {
          "data": [
            {
              "name": "device-configuration1",
              "configuration": [
                {
                  "key": "edge-management",
                  "value": [
                    {
                      "key": "enable",
                      "value": false
                    }
                  ],
                  "enforce": true
                },
                {
                  "key": "edge-module",
                  "value": [
                    {
        				"id": "8a2901fa-ec4f-4642-be14-47a571232eac",
        				"moduleName": "New Edge Module",
        				"repository":{
        					"accessType": "public",
        					"dockerImageName": "myImageName"
        				},
        				"containerOptions": {   
        					"startupFile": "/home/service/start_service.sh",
        					"portMapping": [
        						{"hostPort":1111, "containerPort": 2222}, 
        						{"hostPort":3333, "containerPort": 4444}
        					]
        				}
        			},
                    {
        				"id": "4b5601fa-ec4f-4656-ce14-46b571255eac",
        				"moduleName": "New Edge Module",
        				"repository":{
        					"accessType": "public",
        					"dockerImageName": "myImageName"
        				},
        				"containerOptions": {   
        					"startupFile": "/home/service/start_service.sh"
        				}
                    }
                  ],
                  "enforce": true
                }
              ],
              "id": "1bb15255-72af-43f9-b8ee-f001cefee9b9",
              "assignments": {
                "devices": [
                  2000001308
                ],
                "groups": [
                  41827
                ]
              }
            },
            {
              "name": "device-configuration2",
              "configuration": [
                {
                  "key": "edge-module",
                  "value": [
                    {
        				"id": "8a2901fa-ec4f-4642-be14-47a571232eac",
        				"moduleName": "New Edge Module",
        				"repository":{
        					"accessType": "public",
        					"dockerImageName": "myImageName"
        				},
        				"containerOptions": {   
        					"startupFile": "/home/service/start_service.sh",
        					"portMapping": [
        						{"hostPort":1111, "containerPort": 2222}, 
        						{"hostPort":3333, "containerPort": 4444}
        					]
        				}
        			},
                    {
        				"id": "4b5601fa-ec4f-4656-ce14-46b571255eac",
        				"moduleName": "New Edge Module",
        				"repository":{
        					"accessType": "public",
        					"dockerImageName": "myImageName"
        				},
        				"containerOptions": {   
        					"startupFile": "/home/service/start_service.sh"
        				}
                    }
                  ],
                  "enforce": true
                }
              ],
              "id": "1bb15255-72af-43f9-b8ee-f001cefee7b9",
              "assignments": {
                "devices": [
                  2000001309
                ],
                "groups": [
                  41828
                ]
              }
            }
          ],
          "status": "OK"
        }

        15.5 Assign Device Configuration Deprecated

        Request Body

        Field Type Description
        action String update
        id String ID of the device configuration
        deviceIds
        optional
        JSON[] The list of device ids in following format
        ["deviceid1","deviceid2"]
        groupIds
        optional
        JSON[] The list of group ids in following format
        ["groupid1","groupid2"]

        Request-Example:

        POST
        https://api.teamviewer-iot.com/editdeviceconfigurationassignment

        Request-Body:

        {
        	"action": "UPDATE",
        	"payload": {
        		"deviceIds": [
        			2000001308
        		],
        		"groupIds": [
        			40787
        		],
        		"id": "28696f84-6f4d-4664-8255-d779e7a57d96"
        	}
        }

        Success-Response: (HTTP/1.1 200 OK)

        {
        	"status": "OK"
        }

        16.1 Get contacts

        Success Response

        Field Type Description
        id Long ID of the contact
        name String Name of the contact
        state Integer Availability status of the contact.
        0 - Online
        1 - Busy
        2 - Away
        3 - Offline
        email String Email of the contact
        GET
        https://api.teamviewer-iot.com/contacts

        Success-Response:

         {
            "data": [
                    {
                        "name": "iotdev",
                        "id": 6574,
                        "state": 3,
                        "email": "iotdev@teamviewer.com"
                    },
                    {
                        "name": "test",
                        "id": 5380,
                        "state": 3,
                        "email": "test@teamviewer.com"
                    }
            ],
            "status": "OK",
            "timestamp": 1566990110004
        }

        17.1 Create Edge Module Deprecated

        Request Body

        Field Type Description
        action String create
        name String Edge Module Name
        repository JSON For details check Edge Module Repository Properties section.
        containerOptions optional JSON For details check Edge Module Container Options section.


        Edge Module Repository Properties

        Field Type Description
        accessType String public
        dockerImageName String Docker image name. Allowed characters are [A–Z, a–z], [0–9], [_,-] (no special symbols) and has a limitation of maximum 50 characters.


        Edge Module Container Options

        Field Type Description
        startupFile optional String Startup file name. It should be a valid path, file extension is mandatory.
        portMapping optional JSON[] List of port mappings between docker container and the host. Possible keys are:
        • containerPort
        • hostPort

          Request Example

          POST
          https://api.teamviewer-iot.com/edgemodules

          Request-Body:

          {
             "action": "create",
             "payload": {
          		"name": "New Edge Module",
          		"repository":{
          			"accessType": "public",
          			"dockerImageName": "myImageName"
          		},
          		"containerOptions": {   
          			"startupFile": "/home/service/start_service.sh",
          			"portMapping": [
          				{"hostPort":1111, "containerPort": 2222}, 
          				{"hostPort":3333, "containerPort": 4444}
          			]
          		}
              }
          }

          Success Response: (HTTP/1.1 200 OK)

          {
             "data": {
                "id": "5d4ac2eed4f99c207961a162"
             },
             "status": "OK"
          }

          17.2 Delete Edge Module Deprecated

          Request Body

          Field Type Description
          action String delete
          id String ID of the Edge Module

          Request Example

          POST
          https://api.teamviewer-iot.com/edgemodules

          Request-Body:

          {
             "action": "delete",
             "payload": {
                "id": "5d483930931d9a3214f399b7"
             }
          }

          Success Response: (HTTP/1.1 200 OK)

          {
             "status": "OK"
          }

          17.3 Get Edge Modules Deprecated

          Success Response

          Field Type Description
          id String ID of the Edge Module
          name String Name of the Edge Module
          repository JSON For details check Edge Module Repository Properties section.
          containerOptions JSON For details check Edge Module Container Options section.
          deviceConfigurationIds JSON[] List of device configuration IDs in following format

          ["deviceConfigurationId1","deviceConfigurationId2"]

          Request Example:

          GET
          https://api.teamviewer-iot.com/edgemodules

          Success Response: (HTTP/1.1 200 OK)

          {
             "data":[
                {
                   "id":"5d4ac2eed4f99c207961a162",
                   "name":"New Edge Module",
                   "repository":{
                      "accessType":"public",
                      "dockerImageName":"myImageName"
                   },
                   "containerOptions":{
                      "startupFile":"/home/service/start_service.sh",
                      "portMapping":[
                         {
                            "hostPort":1111,
                            "containerPort":2222
                         },
                         {
                            "hostPort":3333,
                            "containerPort":4444
                         }
                      ]
                   },
                   "deviceConfigurationIds":[
                      "28696f84-6f4d-2415-8255-d779e7a57d96",
                      "28696f84-6f4d-6064-8255-d779e7a5031a"
                   ]
                }
             ]
          }

          17.4 Update Edge Module Deprecated

          Request Body

          Field Type Description
          action String update
          id String ID of the Edge Module
          name
          optional
          String Name of the Edge Module
          repository
          optional
          JSON For details check Edge Module Repository Properties section.
          containerOptions
          optional
          JSON For details check Edge Module Container Options section.

          Request Example:

          POST
          https://api.teamviewer-iot.com/edgemodules

          Request-Body:

          {
             "action": "update",
             "payload": {
          		"id": "5d4ac2eed4f99c207961a162",
          		"name": "New Edge Module",
          		"repository":{
          			"accessType": "public",
          			"dockerImageName": "myImageName"
          		},
          		"containerOptions": {   
          			"startupFile": "/home/service/start_service.sh",
          			"portMapping": [
          				{"hostPort":1111, "containerPort": 2222}, 
          				{"hostPort":3333, "containerPort": 4444}
          				]
          		}
              }
          }

          Success Response: (HTTP/1.1 200 OK)

          {
             "data": {
                "id": "5d4ac2eed4f99c207961a162"
             },
             "status": "OK"
          }
          Show examples in:
          Wobble API Documentation