I’m trying to pull some additional information from the Octopus Energy API which is only available through the GraphQL API. So far I have the following configuration.yaml but I keep receiving the same error, I cannot find a solution.
sensor:
- platform: rest
name: Fan Club
resource: https://api.octopus.energy/v1/graphql
method: POST
payload: '{ "query": "{ fanClubStatus { discountSource current { startAt discount }}}" }'
headers:
Authorization: "Bearer TOKEN_REDACTED"
Content-Type: application/json
{"errors":[{"message":"POST body sent invalid JSON."}]}
I’ve confirmed my token is valid as I can get a valid response from the API when using GraphQL to send the query.