Problem with combination of rest_command, parameter and template use

I have a very simple rest_command:

rest_command:
  execute_xenia_script:
    url: "http://xenia.local/execute_script?ID={{ script_id }}"

The command has.a variable parameter as a two digit number.

Using DevTools - Services delivers the expected outcome.

Using a Button-Card with a static parameter, it works similarly well.

show_name: true
show_icon: true
type: button
entity: input_text.xenia_script_17
tap_action:
  action: call-service
  service: rest_command.execute_xenia_script
  data:
    script_id: '17'

As soon as I use any kind of template for the data: part it all breaks apart and the intended function is not executed.

show_name: true
show_icon: true
type: button
entity: input_text.xenia_script_17
tap_action:
  action: call-service
  service: rest_command.execute_xenia_script
  data:
    script_id: >
       {{ states.input_text.xenia_script_17.name[-2:] | int | string}}

Testing the same approach with a notify service (changing “script_id” to “message”) I see the expected outcome “17” displayed in the message.

Where is my mistake or what is missing to get this combination of rest_command, parameter and template operational?

P.S. I currently use the button-card just for simplification, as the intended use-case is an auto-entities card, but breaking apart at exactly the same point.

Actions - Home Assistant (home-assistant.io)

It is not possible to use templates for actions.

Understood. Any explanation, why this doesn’t apply to notifications?