Create Widget Info in Dashboard - IoT Cloud API

daleonpz
daleonpz Posts: 1
edited April 2023 in IoT Forum
Hi,
 
We're developing an application using the IoT Cloud API. 
We want to add to our dashboard a widget, where one can read sensor information. For example, something like this
 
 
_________________________________
|  Sensor Info:                                 |
|             Name:  Temperature       |
|             S/N:  1564897                  |
|             Vendor:  My Company     |
|________________________________|
 
 
I tried with Text type. This is my json structure in python
 
 
headers = {'Content-type': 'application/json'}
        payload = {
            "action": "create",
            "payload": {
                "dashboardId": dashboard_id,
                "name": "IO-Link-System Info",
                "type": 10,
                "metrics": [
                        {
                                    "Name":  "Temperature",
                                    "SerialNumber":  **Please do not post TeamViewer IDs**,
                                    "Company":     "my company"
                            }
                    ],
                "layout": layout_position
            }
        }
 
but I got an error response from the API.
 
I could create Chart widget, with no problem.
 
Could you give me some hints about how I create this type of widget with your API?
 
Thanks

Comments

  • mircea_c
    mircea_c Posts: 146 Staff member 🤠

    Hi @daleonpz

    It seems that the layout is not correct. Should be something like:

    "layout": {
    "width": 2,
    "height": 6
    }

    Also, can you share the error message?

    Regards,

    Mircea

    Tech Support IoT