Thingsboard: Create a “rest api call” button in a dashboard

醉酒当歌 提交于 2020-12-06 19:44:50

问题


I am trying to create the following in Thingsboard:
In a dashboard create a button, when it is clicked a rest api call to an external server is made. So far I have found that it is possible to define a rule chain with "rest api call" node, but I am unable to find a good rule which will lead to its execution (sending an api each time an entity is created obviously is a bad option)
In the "control widgets" I was not able to create a working solution but it looks like the correct way.


回答1:


I have figured a way to do it, not the best but it works:

  1. Create a board
  2. Create an "Update Device Attribute" control widget
  3. Go to "Edit" in the "Update Device Attribute" control widget, pick an unused device (it might be possible to pick a used device but i am not sure if the operation might alter it), go to "Advanced" and set "Device attribute parameters to any valid json, for example: {"rest":1}
  4. Go to "Rule Chains" and create the following rule: Input -> Message Type Switch -(Attribute Updated)-> Rest Api Call (choose from nodes-external)
  5. In the "Rest Api Call" set the required endpoint url and method, then apply change

If you have configured everything properly, every time the button is clicked an api call will be made



来源:https://stackoverflow.com/questions/63683220/thingsboard-create-a-rest-api-call-button-in-a-dashboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!