0

Which day I can not understand the reason for such a problem. I'm trying to get data from the Coingecko API in Google App Script. The simplest script

function ping() {
  var url = 'https://api.coingecko.com/api/v3/ping';
  var params = {
    'cache-control': 'public,max-age=300',
    'content-type': 'application/json', 
    'expires': 'Tue,04 Oct 2022 23:59:39 GMT'
  };

  var response = UrlFetchApp.fetch(url, params);
  var data = JSON.parse(response.getContentText());

  Logger.log(data);
}

gives an error message

Exception: Request failed for https://api.coingecko.com returned code 429. Truncated server response: {"status":{"error_code":429,"error_message":"You've exceeded the Rate Limit. Please visit https://www.coingecko.com/en/api/pricing to subscribe to ... (use muteHttpExceptions option to examine full response)

But! I immediately enter a request in any browser https://api.coingecko.com/api/v3/ping And I get a normal response

{"gecko_says":"(V3) To the Moon!"}

What does this mean and how to deal with it?

Rubén
  • 34,714
  • 9
  • 70
  • 166
abb2
  • 7
  • 1
    (jsut thinking aloud) API may be counting quota based on IP address. Apps Script's URLFetchApp uses ranges of IPs that shared across all (thousands?) users of Apps Script. Some percent of those users already called URLFetchApp – Kos Oct 04 '22 at 14:41
  • Idea is to retry request - until you get lucky IP address that has not reached quota – Kos Oct 04 '22 at 15:34

0 Answers0