Anyone got skolmaten.se API working since then change?

They have changed their API and I just can’t get it working.

The commented is how it worked before, and the new thing is that the client token should be in header instead.

- platform: rest
    name: Matsedel Backaskolan
    #resource_template: "https://skolmaten.se/api/3/menu/?client=AAAA&school=5726716454502400&limit=2"
    resource_template: "https://skolmaten.se/api/4/menu/?school=5726716454502400&limit=2"
    method: POST
    payload: '{ "client-token" : "AAAA" }'
    value_template: '1'  
    json_attributes:
      - "weeks"
    scan_interval: 86400 

I have also tried some of their examples just to get the IDs and such with POST Requests Online but even when I use their most basic API endpoint I get:

{
    "errors": [{
        "message": "Route not found"
    }]
}

Skolmaten

A payload is not a part of the header, a payload would be the body of the request.

All their API documentation examples use method GET, not POST.

School ID should be the final part of the URL, not a query parameter.

Your value_template makes no sense as the expected return value is a dict, not a list.

I suggest you read the API documentation again…

@Sir_Goodenough This is not an integration. It’s a rest API call as you can see from the yaml.

Yes… it should be in header. My bad.

I have tried both GET and POST, both in HA and outside of HA but none of them work.
And as I said before even endpoints like provinces/ that doesn’t need any parameters work.

Stats can only hold 255 characters so the value_template can’t be used. The data is in the attributes

So did you get a brand new API key just now or are you using a preexisting key? While the documentation doesn’t say anything about it, it would hardly be surprising if the v4 API required a new key and all old credentials were thrown out when the v3 API was deprecated…

No I did not get a new key, but I would also be surprised if they would add that much extra work to assign new keys to everyone.

But I found this, so not sure anymore… Skolmaten change something? · Issue #17 · Kaptensanders/skolmat