Using friendly name in a REST Command

I am integrating with a third party system using REST commands and a web hook.
Configuring each entity is a bit cumbersome as the format of the data needed by the third party app doesn’t align well with the entity_id. I’d like to use the friendly name as the data in the rest_command, but I get an error.
I’ve also tried using a template to convert the entity name, but again it errored.

Is there a better way of doing this?
TIA

  cortex_light_on:
    url: http://192.168.0.78/api/v1/json/objects/{{cortex_light_name}}?Turn%20on=1
    method: POST
    username: !secret CortexAPIuser
    password: !secret CortexAPIpass
    content_type: "application/json"
    payload: "{}"

This is called by lights created in a template … with lots of repitition

#
    family_room_seating_lights:
      friendly_name: Family Room Seating Lights
      turn_on:
        service: rest_command.cortex_light_on
        data:
          cortex_light_name: Family Room Seating Lights
      turn_off:
        service: rest_command.cortex_light_off
        data:
          cortex_light_name: Family Room Seating Lights
#
    dining_down_lights:
      friendly_name: Dining Down Lights
      turn_on:
        service: rest_command.cortex_light_on
        data:
          cortex_light_name: Dining Down Lights
      turn_off:
        service: rest_command.cortex_light_off
        data:
          cortex_light_name: Dining Down Lights
#