locked
Why I am getting too many request error RRS feed

  • Question

  • User746671234 posted

    I'm trying to fetch balance using bitcoin api.  If user makes a payment I need to find it continuously and update the control.  So I am using it like

    window.addEventListener('load', function () {
                window.setInterval(function () {showBal();}, 30000)                       
            }, false);
    
    
            function showBal() {
                var spname = $("#lblBit").text();
                $.ajax({
                    type: "POST",
                    url: "success.aspx/CheckBal",
                    data: '{bAdd: "' + spname + '" }',
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (response) {
                        console.log(response.d);                   
    if (parseInt(response.d) > 0) {
                            window.clearInterval;
                          window.location.href = 'paydone.aspx';
                        } }, failure: function (response) { alert(response); } }); }

    But it gives me an error like "Additional information: The remote server returned an error: (429) Too Many Requests."

    Can anyone tell me how to manage this error

    Tuesday, September 15, 2020 12:04 PM

All replies

  • User753101303 posted

    Hi,

    It happens when  the server side is limiting http requests done in a given time. It seems you are calling your own API which in turn calls a 3rd party API? On which one do you have this problem? Either:
    - it is on your site and you could change the configuration
    - or it is on a 3rd party site and you need to issue less frequent http calls
    - or maybe you have a webhook feature allowing to know when a payment is completed (as it seems what you try to do ?)

    I would really double check #3. For 3rd party API doing background operations they often provide a "webhook "capability which allows to be notified when an operation is completed on their side. I would really double check the doc for your payement provider.

    Tuesday, September 15, 2020 12:31 PM
  • User746671234 posted

    Hi,

    It happens when  the server side is limiting http requests done in a given time. It seems you are calling your own API which in turn calls a 3rd party API? On which one do you have this problem? Either:
    - it is on your site and you could change the configuration
    - or it is on a 3rd party site and you need to issue less frequent http calls
    - or maybe you have a webhook feature allowing to know when a payment is completed (as it seems what you try to do ?)

    I would really double check #3. For 3rd party API doing background operations they often provide a "webhook "capability which allows to be notified when an operation is completed on their side. I would really double check the doc for your payement provider.

    Yes, I'm using 3rd party site and it gives me an error.  If I issue frequent call then it will not solve my issue. Actually after registration I show payment page with payment address and amount (It's a BTC Payment) to user and it keep on searching if payment has done.

    Yes, I get response from their api on callback url but it takes too much time even after payment done.  So I am using another balance api which shows the balance.

    Tuesday, September 15, 2020 12:42 PM
  • User753101303 posted

    This is precisely intended to prevent too frequent calls and you won't have any way around that. I would start by checking  their documentation to see what is the current limitation.

    According to the earlier link it seems you may have a https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After header to suggest when to call the API again. And/or when having a 429 you could consider adding a bit of time to the interval to wait longer before trying again.

    Maybe even this behavior depends on which plan you have? For now I would really start by checking on their side to see if I can find if all this kind of limit or notification behavior is documented (and if it depends maybe on a selected level of service).

    Tuesday, September 15, 2020 1:23 PM