Piecing it together Rest Switch - Entity

I am just trying to create a card with an entity(?) that has an on off button for a simple esp8266 relay. The URLs are http://relay/?S=On and http://relay/?S=Off Both return
{ “POWER” : “ON”} or { “POWER” : “OFF”}. I was able to hack my way through to create a circular widget on the dashboard that shows status via the Rest Sensor (http://relay/status) which has the same json returned as above.

I am struggling with translating this rest switch example into on-off control of my esp8266. I don’t want to use the esp8266 integration, it is over my head, though I can write code for esp8266, etc.

switch:
  - platform: rest
    resource: http://relay/?S=
    body_on: '{"POWER": "ON"}'
    body_off: '{"POWER": "OFF"}'
    is_on_template: '{{ value_json.POWER }}'
    headers:
      Content-Type: application/json

I know I am missing something, also will I see the ‘switch’ as an entity that I can add to a card once I have it correct ? I have looked at many videos and web pages and it just eludes me.
Thanks

Try this (everything else as you have it):

    body_on: 'On'
    body_off: 'Off'
    is_on_template: '{{ value_json.POWER == 'ON' }}'

Yes you will be able to use and control the switch in the front end. It will also display changes of state if the switch is controlled from outside home assistant.

Thanks, I tried it and had to rearrange the " and the ’ to prevent safe mode. The card was created, but the button/switch just goes back to off when you slide it on.

Edit: tcpdump shows the ON is not being appended to the resource URL
16:14:28.712996 IP pi.33202 > 1.2.3.4.http: Flags [P.], seq 1:189, ack 1, win 64240, length 188: HTTP: GET /cm?cmnd=Power+ HTTP/1.1 Ideas ? Thanks

switch:
  - platform: rest
    resource: http://relay/cm?cmnd=Power+
    name : 'ESP1'
    body_on: 'ON'
    body_off: 'OFF'
    is_on_template: '{{ value_json.POWER == "ON" }}'
    headers:
      Content-Type: application/json

Why did you change your resource?

The body messages I provided are not what you have. e.g. ON vs On.

Sending ON vs On has the has same effect, the return is all caps. The resource changed because I was writing a generic URL first. I would just like to know how to have the ON and OFF appended to this URL, that is what will make it work. Edit: Post makes no difference. This just seems too basic, to not be able to figure out. It processes status properly.
08:36:11.966036 IP pi.35536 > 1.2.3.4.http: Flags [P.], seq 1:209, ack 1, win 64240, length 208: HTTP: POST /cm?cmnd=Power+ HTTP/1.1

This is one frustrating tool. I even tried cmdline. Only error on start up.

switch:
  - platform: command_line
    scan_interval:
      seconds: 10
    switches:
      ESP1:
        command_on: "curl -X GET 'http://relay/cm?cmnd=Power+ON'"
        command_off: "curl -X GET 'http://relay/cm?cmnd=Power+OFF'"
        command_state: "curl -X GET 'http://relay/cm?cmnd=Power'"
        value_template: "{{ value|lower }}"