IoT Stadium

API Documentation

Widget

Widget - POST Add Widget

Post

{{url_iot_backend}}/ext/dashboards/:dashboardId/widgets
{
	"key": "Content-Type",
	"value": "application/json"
},
{
	"key": "Authorization",
	"value": "Bearer {{token}}"
},

Parameter

Field Type Description
widget_name String

Name of the widget

decription String

Description of the widget

width Integer

Width in grid units (2–12). Corresponds to % layout width.

height Integer

Height in px. Min: 150, Max: 600

widget_type String

Widget type

data_source Array

Array of data sources for the widget

data_source[].label String

Display name on the widget

data_source[].min_value Number

Required for bar-gauge or gauge types

data_source[].max_value Number

Required for bar-gauge or gauge types

data_source[].device_id Integer

The ID of the device providing the telemetry

data_source[].telemetry_key String

Key from device telemetry

data_source[].unit String

Unit to display

{
    "widget_name": "test gauge chart", // required
    "description": null,
    "width": 6, // this (value) : (label) [2:16%,3:25%,4:33%,5,41%,6:50%,7:58%,8:66%,9:75%,10:83%,11:91%,12:100%] -> format option key width
    "height": 300, // min 150 | max 600 px(pixel)
    "widget_type": "gauge", // type widget (value):(label) = [line:line chart,area:area chart,gauge:gauge,bar:bar chart,table:table,bar-gauge:bar gauge,heatmap:heat map,card:card,device-controller:controller,map:map]
    "data_source": [
        {
            "label": "temp22",
            "min_value": 10, // The value of this key is filled when it is of type bar-gauge, gauge
            "max_value": 20,// The value of this key is filled when it is of type bar-gauge, gauge
            "device_id": 617,
            "telemetry_key": "temp",
            "unit": "°C"
        }
    ]
}                                            
{
    "message": "dashboard created",
    "data": {
        "id": "810"
    },
    "code": 200
}
{
    "message": "Invalid Message",
    "code": 400,
    "errors": [
        {
            "field": "widget_name",
            "message": "The widget name field is required.."
        }
    ]
}