Rest-command with custom authentication

I want to read out certain values with HA and found that the website has an (undocumented) REST api. I think I should be able to use rest_command but I am a bit puzzled how to approach this as this particular api needs a login first.

The login happens with a POST to a url, e.g.
in the body some json is sent:
{ "email":"[email protected]", "password":"verysecretpassword", "languageCode":"nl", "autoLogin":false }

After this login a cookie is added:
Set-Cookie: JSESSIONID=BF7AB38085BD0FB7A036A50ABE425C98; Path=/; Secure; HttpOnly

A second call is then made to e.g. (http POST) which returns JSON data.The cookie is of course also sent e.g:

I would like to expose the returned json (.e.g description) as sensor and show it in a dashboard.

Reading this I am not sure how to add the login step. So any help or example is appreciated!

1 Like

have you solved this issue? I am facing very similar Use Case and would like to know how to approach it.

Guy, did you manage? I have a similar question