I am getting this error in the logs for a few rest commands, that have worked reliably in the past. I confirmed the URL worked when entered in a browser, so I have ruled that out. I assume something changed with formatting, but I couldn’t find anything related in the recent changelogs.
Did you ever find a resolution to this? (This thread still comes up first in Google when looking for Rest Command issues in Home Assistant.)
I have the exact same behavior, where IP address works but a hostname doesn’t. The machine running Home Assistant is able to ping the target device by hostname, so it’s definitely able to DNS resolve the name correctly, but HA’s Rest Command itself doesn’t seem to be able to.
I used to run HA in a proxmox container, and REST commands worked as expected. Then I switched to a supervised install and I rest commands would complain about “client error”. Same problem at a different supervised installation at a odroid c2
In my case I now think its related to the network configuration - the packaged version of home-assistant uses an internal network which can’t resolve domains in my local network. I’m switching back to running home-assistant in a lxc container (proxmox). Works good enough for me.