4

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.

Uri Loya
  • 1,181
  • 2
  • 13
  • 34

1 Answers1

2

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 a rest api call will be made

Uri Loya
  • 1,181
  • 2
  • 13
  • 34
  • 2
    You can ad the "Rest Api Call" directly under the "Message Type Switch" of the default "Root Rule Chain" – Olivier Jul 27 '22 at 14:44