Hello,
I have an existing rule to communicate with my wallbox. It was working fine since 1,5 years. However I now encountered a problem with sendHttpPostRequest
.
My code snippet is looking like this:
url = “https://api.easee.cloud/api/accounts/token”
easeeRequestBody = ‘{ “userName”: “user”, “password”: “xxxxxx” }’
json = sendHttpPostRequest(url, “application/json”, easeeRequestBody, 5000)
I receive now the following error:
{“errors”:{“”:[“A non-empty request body is required.”]},“type”:“RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content or more validation errors occurred.”,“status”:400,“traceId”:“00-7f2d99830fa57c13fcec9b8e2c50ac87-45abba88fd6f9803-00”}
But with the command above I am not sending an empty body. If I do the same Post Request via Postman, I get the expected result.
As said, It was running since 1,5 years. Any change happened here? I have openHAB 3.2.0
Hi
I second your problem I recently saw this since I was on a trip. But right now, i figure that easee request a body and not just headers as I beleive in this case. I will try to solve this for myself and if I make progress report it here, but I will also suggest looking into the development of easee binding, whicg right now isn’t ready but the more we contribute the faster it may be done.
Hi
I just started troubelshooting this and in Postman my original request still works, and looks like this, and I therefore tried to make headers into a hasMap, but I still haven’t figured out how to make this work.
val headers = newHashMap(“accept”->“application/json”)
sendHttpPostRequest (“https://api.easee.cloud/api/accounts/token",“application/json”,'{“userName”:"my username”, “password”:“mypassword”}',headers, 5000)
curl --location --request POST 'https://api.easee.cloud/api/accounts/token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Cookie: AWSALB=Iyk2reM8Fj21gcBK11oFBIEJmVuzzbV9jh2Baoc6v3C/elnqWOFANMDQqC2HrjDDCPgLeEiEjvkpFo/Cm7xo4EyYhVHbi1enDTnJjUBgGE0unwzPpB8vDCVBLH9J; AWSALBCORS=Iyk2reM8Fj21gcBK11oFBIEJmVuzzbV9jh2Baoc6v3C/elnqWOFANMDQqC2HrjDDCPgLeEiEjvkpFo/Cm7xo4EyYhVHbi1enDTnJjUBgGE0unwzPpB8vDCVBLH9J' \
--data-raw '{
"userName": "my username",
"password": "my password"
}'
Thanks for joining. I have the exact same behaviour. It works fine in Postman but it does not work via Openhab anymore. So far I haven’t figured out why this is the case and where does it come from.
Hello,
I found the solution. It is indeed a change in the API of Easee. You need to replace https://api.easee.cloud/api/accounts/token with
https://api.easee.cloud/api/accounts/login’ then it will work again. The other call is deprecated