Home Assistant & API rest

Hi all,

When I’m reading data from a webserver in a web browser with the following URL:

I got a nice answer:

However, when I’m trying to code into Home Assistant configuration.yaml file, with the following code, it fails:

# Sensors
  - verify_ssl: false
    scan_interval: 10
      - name: "sid_token"
        unique_id: sid_token
        value_template: '{{ value_json.SessionId }}'
  - verify_ssl: false
    scan_interval: 1
    resource:{{ states.sensor.sid_token.state }}&Id=671
      - name: "Temp ext."
        unique_id: temp_ext
        value_template: '{{ value_json.Description.Value }}'

I have no error on my home assistant configuration, I just failed to get my value into the development tools → stats of entities

Any help would be appreciate

Precision: I’m a total beginner in coding in yaml

I don’t think you can do the authentication the way you have it setup, or at least I’ve never seen someone do it that way. Because you are authenticating separately from the actual call, I won’t be surprised if the session is expiring. At a minimum, you really should look through the docs again on the Rest Sensor. I doubt any login script is just going to take a username and password in the URL like that. That would be horribly bad security practice.

There is a way to create a rest sensor that uses basic or digest auth. If the particular service uses some other kind of form based authentication, you might be out of luck.


The main issue is that it looks like I need SessionId to access any data: