Templating for entity attribute in URL rest_command

In my configuration, I have a URL being sent via rest_command to give GPS coordinates to a web service. Right now I have those coordinates hard-coded into the command. How can I replace those with the longitude and lattitude attributes of the device_tracker.iphone entity that I have? I can verify that within that entity, I have my current GPS long. and lat.

Current code:

rest_command:
  namehere:
    url: 'https://domain.com/?id=1234&timestamp=1234&lat=45.234&lon=-90.234&speed=0&bearing=0&altitude=0&accuracy=5&batt=100'

I’d like to do something like:

rest_command:
  namehere:
    url: 'https://domain.com/?id=1234&timestamp=1234&lat={{ state_attr('device_tracker.iphone', 'Lattitude' }}&lon={{ state_attr('device_tracker.iphone', 'Longitude' }}&speed=0&bearing=0&altitude=0&accuracy=5&batt=100'

But that hasn’t worked and I haven’t been able to make any combination of quotes work. Can I do templating like that right in the URL option or is there some other way?

I doubt the latitude/longitude attributes have a capital, do they?
And Lattitude seems misspelled, anyway.

You are correct on both counts. I don’t know if that was the issue or not as I went a different direction. Now I want to try again to see if it was the issue!

For those curious, I handled it by using my own variable template in the URL, {{ gps }} and defining that “gps” in a short script that calls the rest_command.

rest_command:
  namehere:
    url: 'https://domain.com/?id=1234&timestamp=1234&speed=0&bearing=0&altitude=0&accuracy=5&batt=100&{{ gps }}'
gps_tracking:
  sequence:
    service: rest_command.namehere
    data: 
      gps: "lat={{ state_attr('device_tracker.iphone', 'latitude') }}&lon={{ state_attr('device_tracker.iphone', 'longitude') }}"