you can use either function. You’ve posted links to the docs, so you managed to find them. If you scroll down you’ll see examples for you to copy and adapt to your needs
switch:
platform: command_line
switches:
arest_pin_four:
command_on: "/usr/bin/curl -X GET http://192.168.x.x/integration/push?code=34234234324"
command_off: "/usr/bin/curl -X GET http://192.168.1.10/digital/4/0"
command_state: "/usr/bin/curl -X GET http://192.168.1.10/digital/4"
value_template: '{{ value == "1" }}'
friendly_name: Kitchen Lightswitch
You need to update the above command URLs for the On, Off commands, and the State one.
The value template is a formula that tells HA what value means on. In above example, the command_state URL would return only 1 character: “1”. The Value template tells HA that 1 means on