Hello everyone,
First of all, sorry for my poor English, as it is not my native language.
I’m trying to establish a connection between the Home Assistant API and an Angular application.
I’m having problems to access some endpoints, especially history/period/.
I think my Angular application is well configured.
Indeed, I can access the API correctly via a call to /api, which returns “API running” correctly.
To achieve this, I had to create a long time token from Home Assistant and put it in the HTTP request header (Authorization: Bearer [TOKEN]).
Moreover, I had to add in configuration.yaml the origin of my Angular application (option cors_allowed_origins).
On the other hand, when I try to call a GET endpoint taking parameters, an error 405 “Method Not Allowed” was returned to me.
The call parameters are the following (for example) :
- Method : GET
- URL : [HA]:8123/api/history/period/2020-09-05?filter_entity_id=sensor.detector_kitchen_temperature
- Authorization: Bearer [HATOKEN]
Endpoints without parameters in the URL work correctly on my Angular application. On the other hand, URLs with parameters do not work.
I specify that all requests (with and without parameters) work when In use Postman (adding the authorization token in http request headers)
Am I missing something?