http request to netatmo fails with error (solved!)
-
Hi, can anyone help me with connection to the Netatmo API?
https://dev.netatmo.com/resources/technical/samplessdks/codesamplesI tried it with the new http request block but I get the error "invalid_request, Invalid grant_type parameter or parameter missing"
What could be the problem?
-
May sound stupid but have you tried
payload = {'grant_type': 'authorization_code',
Perhaps your code should be key "grant_type" value authorization_code
-
thx, but this seems not to be the solution (I tested it anyway). Grant-Type "password" is correct afik.
-
@dblooom The header option should be like it.
-
oh, that was wrong, thx. But still get the same error...
-
Ok, could figure it out. The http-req sends data as JSON but Netatmo needs it as "data". So I could change it in Phyton code but can't do it in blocky.
@devs: So it would be nice to have two different slots in the http-reqthing: one for json-data and one for data. Or an option to switch it.
-
@dblooom please post this as a bug report on the UIFlow github page as this is important enough for immediate attention
-
@ajb2k3 hm thx. But I'm not familiar with github. Maybe you can submit it for me?
-
@dblooom said in http request to netatmo fails with error (solved!):
@ajb2k3 hm thx. But I'm not familiar with github. Maybe you can submit it for me?
Done. -
@dblooom Hi. Sorry for resurrecting this topic, but I can't figure it out at all and haven't found any other resources regarding "Netatmo" and M5Stack on the web. I've tried to fix this issue by replacing "json={'grant_type':'password', ...}" with "data={'grant_type':'password', ...}" and also "data=[('grant_type','password'), ... ] and still had lo luck with it.
I have no problem getting a correct response when working with Postman or directly with Python, but I'm not able to figure out what's wrong in UiFlow.
Would you perhaps have time to elaborate on how you have managed to fix it in "python portion" of the UiFlow if you still remember?
Sorry again for the inconvenience.
Best regards. -
Hi
is it possible to share you code ? interest by this code.
for me the UIFlow not work with my M5 stack so I use only arduino ide interface.
Thx