Error 400 for float values
-
Since a couple of days I noticed my post requests get the 400 error, the text on that is basically this repeated for all the values I send:
{"observations":[{"index":1,"errors":[{"value":"10.4","property":"temp","children":[],"constraints":{"max":"temp must not be greater than 100","min":"temp must not be less than -100","isNumber":"temp must be a number conforming to the specified constraints"}},{"value":"2.5","property":"wind","children":[],"constraints":{"max":"wind must not be greater than 150","min":"wind must not be less than 0","isNumber":"wind must be a number conforming to the specified constraints"}}
I didn't change anything in my code since months, so I'm guessing you guys changed how you handle float values? I really can't figure out why it's giving me so many errors..
-
@pol9 Hi, are you sending the values as a number and not as a string?
This is correct
{ "temp": 10.4 }
This is not
{ "temp": "10.4" }
-
@David-Ryzec-3 I send floats
python prints " " when dealing with dicts -
@pol9 Can you check that you also send floats in http request? Response from our server says that what you are sending is not number. Check please if library you are using is not serializing floats as string.
-
@David-Ryzec-3 I was indeed sending strings, really sorry about that..
I still get the 400 error though, with this text:
{"observations":[{"index":1,"errors":[{"value":"2024-06-25T21:00:00.000Z","property":"time","children":[],"constraints":{"isTimestampInLastNMinutes":"time must be in last 5 minutes"}}Since the stations aren't mine, and I'm just getting the data from an API I can't really control the update times, they usually post a new update every 15 minutes but it depends by the station.. Is there any solution to this? I think in the past you allowed older (albeit timestamped) data, but maybe your policies changed?
Thanks anyways -
@pol9 Hi, I am glad we solved the float issue.
I will increase the limit for timestamps, five minutes is really too strict.