'Failed to resolve API Key' when trying to setup RESTful Sensor

I am trying to create a RESTful Sensor that get EPG/TV guide data from the API of the Danish Broadcasting Corporation. The API is pretty well descriped (link) and I just have to add two parameters to the headers:

- Add parameter to “schedule” headers - APIkey (insert APIkey recieved from APIgee portal)
- Add parameter to “schedule” headers- *Accept* key and select “*application/XML*”

Not too difficult I thought, and this is what I have added to configuration.yaml (without all the x’s in the key)

Sensor:
  - platform: rest
    name: RAMASJANG
    resource: https://api.dr.dk/epg/api/schedules/TVR/2021-12-15
    headers:
      Authorization: XXXXXXXXXXchhPKNZoul6KpgAAK0r8Fu
      Accept: application/xml
      User-Agent: Home Assistant REST sensor 

The RAMASJANG sensor is created but when I look at its state in Developer Tools I get this message:

{“fault”: {“faultstring”: “Failed to resolve API Key variable request.header.apikey”, “detail”: {“errorcode”: “steps.oauth.v2.FailedToResolveAPIKey”}}}

I have tried replacing Authorization with APIkey but it changes nothing, same ‘fault’ error.

What do I have to change under Authorization to get it working?

I have tested the API in Postman, so I know it is working


This here gets a response.
Avoid always capital letters in system names. Its ok in friendly names, but not just name, and the check config does not detect them.
I also added method to the setup and changed authorization to APIkey as the guide describe.
You will get the result back with this, but HA will not be able to store it in the current state, since the state of a sensor can only be 255 characters long and the result is way more than that.

sensor dr:
  - platform: rest
    name: dr_rama
    method: GET
    resource: https://api.dr.dk/epg/api/schedules/TVR/2021-12-16
    headers:
      APIkey: xxxxxxx
      Accept: application/XML
      User-Agent: Home Assistant EPG