I am able to call it and get the JSON details from my web browser and from postman.
But when I use it in a Rest Sensor is get the following error in HA ‘Error fetching data: <PreparedRequest [GET]>’
Could be that there are some chars in the API key which YAML don’t like. There could also be an issue with the certificate. We do validation per default.
Could you please explain further on what you said “There could also be an issue with the certificate. We do validation per default” is there something I could do to check or fix this?
Have you tried using curl from a shell on the platform on which you are running HA? If it works from there, but not from the REST sensor in HA, it could be an issue of the root certificate authority. I had an issue a while ago (when I was using SmartThings) where an HTTPS URL worked on my browser, but it didn’t work on ST, because the root certificates that ST had didn’t support the root authority of the site. (Sorry if I’m using incorrect terms. Not an expert on this topic.) Bottom line, if it works with curl in a shell of the HA platform, then you could change from a REST sensor to a shell command sensor that uses curl.
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
Ok, not surprisingly it would seem curl and HA are using the same root certificates. My guess is you’re going to need to update the root certificates on your HA platform to support the certificate of this particular site. But, unfortunately, I really don’t know how to do that.
If it’s just a certificate error that’s stopping you and you trust the source, you could add verify_ssl: false
That will ignore the cert error. It solved my problem recently.
Correcting the certificate error is of course the best solution.