REST sensor - how to authenticate and pass headers?

Hi everyone
Someone gave me a way to extract the data from the local power provider.
It requires authentication, storage or headers (which I guess will have auth info) and then requesting data through their REST API.
Is it possible to do inside HA itself, or I need to make my own docker image etc and send via MQTT?

1 – Login & store headers to a file
curl -d ‘username=xxxx&password=xxxxx&submit=Login’ --dump-header headers https://selfserve.synergy.net.au/apps/rest/session/login.json

2 – Now get the data, using the headers
curl -L -b headers ‘https://selfserve.synergy.net.au/apps/rest/intervalData/000xxxxx/getHalfHourlyElecIntervalData?intervalDeviceIds=000000000xxxxx&startDate=2022-02-01&endDate=2022-03-01’
(remember to provide account # and meter #)

1 Like