Need help with Rest API

I have a Rest command configured in my configuration.yaml that looks like this

rest_command:
  acurite:
    url: "http://192.168.1.142:667/AcurFiles"
    method: put
    headers:
      accept: "application/json, text/html"
      user-agent: "Mozilla/5.0 {{ useragent }}"
    payload: '{"source": "{{ source }}","temperature": "{{temperature }}","humidity":"{{ humidity }}"}'
    #payload: '{"temperature": "{{states(sensor.acurite_tower_a_3249_temperature)}}"}'
    content_type: "application/x-www-form-urlencoded"

When I test this action from the Developer Tools

action: rest_command.acurite
data:
  source: Acurite
  temperature: "77.1"
  humidity: "35"

Everything works as expected on the Web Server and I get a correct json string

{"source": "Acurite","temperature": "77.1","humidity":"35"}

My question I have is how do I insert the actual sensor data into this process? I have tried defining the sensor in the Rest command, tried to define the sensor in the Developer Tools end. I am at a loss. any help would be appreciated.

;

Are you asking how to make a sensor from the REST data? For that you would create a “template sensor” which state would be the data from your REST command.

Or are you trying to POST data to another server? Try adding method: POST to your acurite definition.

If you want send data from entities to your rest api, you’d need to use templates:

action: rest_command.acurite
data:
  source: Acurite
  temperature: "{{ states('sensor.my_temp_sensor') | float(0) }}"
  humidity: "{{ states('sensor.my_hum_sensor') | float(0) }}"

Ok Thanks!! It now works. I guess my problem was trying to figure out the correct syntax. I can now set up an automation or other method to send Acurite temperature and humidity data to my SQL server database.

action: rest_command.acurite
data: 
  source: Acurite
  temperature: "{{ states('sensor.acurite_tower_a_3249_temperature') | float(0) }}"
  humidity: "{{ states('sensor.acurite_tower_a_3249_humidity') | float(0) }}"

I can add other data too, such as battery level, RSSI, etc.
Thanks