[HTTP] implement a switch using two commandExtensions

I’m on OH3.4.x and trying to implement a Thing providing a REST API using the HTTP binding.
There is a functionality to turn something on and off using the API but the required POST requests for those are hitting different endpoints (commandExtension).

I haven’t found an example or hint in the documentation for the channel definition if I want to have one OH “switch” to send the corresponding API request.

Is this possible somehow or would I need to implement two switches and do something around managing the state of those (to reflect something like a push-button)?

Thanks,
Wolfgang

1 Like

The easiest thing to do is to write a rule. You can use HTTP action in probably any language or whatever native http library is available from the specific language chosen.

If you need further help, tell us which language and whether you want to use UI based rule or file based rule.