Windy Community
    • Unread
    • Categories
    • Groups
    • Go to windy.com
    • Register
    • Login

    Error 400 for float values

    Windy Stations
    2
    6
    1.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pol9P
      pol9
      last edited by

      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..

      David Ryzec 3D 1 Reply Last reply Reply Quote 0
      • David Ryzec 3D
        David Ryzec 3 Developers @pol9
        last edited by

        @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"
        }
        
        pol9P 1 Reply Last reply Reply Quote 0
        • pol9P
          pol9 @David Ryzec 3
          last edited by

          @David-Ryzec-3 I send floats
          Immagine 2024-06-22 173047.png
          python prints " " when dealing with dicts

          David Ryzec 3D 1 Reply Last reply Reply Quote 0
          • David Ryzec 3D
            David Ryzec 3 Developers @pol9
            last edited by

            @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.

            pol9P 1 Reply Last reply Reply Quote 0
            • pol9P
              pol9 @David Ryzec 3
              last edited by

              @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

              David Ryzec 3D 1 Reply Last reply Reply Quote 0
              • David Ryzec 3D
                David Ryzec 3 Developers @pol9
                last edited by

                @pol9 Hi, I am glad we solved the float issue.

                I will increase the limit for timestamps, five minutes is really too strict.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Windyty, S.E. - all rights reserved. Powered by excellent NodeBB
                NodeBB & contributors, OSM & contributors, HERE maps
                Terms of Use     Privacy Policy