Restful sensor with URL template?

hi
I would like to automate SmartThings Air conditioning on my own, to avoid exposing my HA on the internet with webhook needed with official SmartThings integration.

I decided to go with RESTful sensors to get the info about state.

So far I have this and it works:

rest:
  - headers:
      Authorization: >
        Bearer redacted
      Content-Type: application/json
      Accept: application/json
    scan_interval: 180
    method: GET
    resource: https://api.smartthings.com/v1/devices/AC_UNIT_ID_HERE/status
    sensor:
      - name: "pracownia_klima_airConditionerMode"
        value_template: "'{{value_json.components.main.airConditionerMode.airConditionerMode.value}}'"
      - name: "pracownia_klima_airConditionerFanMode"
        value_template: "'{{value_json.components.main.airConditionerFanMode.fanMode.value}}'"
      - name: "pracownia_klima_airConditionerMode"
        value_template: "'{{value_json.components.main.airConditionerMode.airConditionerMode.value}}'"
      - name: "pracownia_klima_switch"
        value_template: "'{{value_json.components.main.switch.switch.value}}'"
      - name: "pracownia_klima_temperatura"
        value_template: "'{{value_json.components.main.temperatureMeasurement.temperature.value}}'"
        unit_of_measurement: "°C"
      - name: "pracownia_klima_thermostatCoolingSetpoint"
        value_template: "'{{value_json.components.main.thermostatCoolingSetpoint.coolingSetpoint.value}}'"
        unit_of_measurement: "°C"

this is for one device. The rest of the sensors for other AC units will differ by URL only. Is there an elegant way so I don’t repeat myself for each AC unit?

No. You need to create a separate resource and sensors for each device.