Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Coinmarketcap API change of endpoint URI + API Key #49

Open
gonzague opened this issue Mar 22, 2021 · 2 comments
Open

Coinmarketcap API change of endpoint URI + API Key #49

gonzague opened this issue Mar 22, 2021 · 2 comments

Comments

@gonzague
Copy link

Hey,

The Coinmarketcap API requires a key and the endpoints have changed :-)
It's now reachable over https://pro-api.coinmarketcap.com/v1/** and it is possible to get a free API Key here https://pro.coinmarketcap.com

however I dont know how to fix the .js files

Thanks!

@stevegwh
Copy link

stevegwh commented Mar 24, 2021

Hey there,

Try this: replace "coinmarketcap" (for me, line 7) with this:

function coinmarketcap() {
  var options = {
    'headers' : {
      'X-CMC_PRO_API_KEY' : 'YOUR_API_KEY'
    }
  } 
  var url = "https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?convert=EUR&limit=400";
  var response = UrlFetchApp.fetch(url, options);
  var text = response.getContentText();
  var obj_array = JSON.parse(text);
  return obj_array;
}

I can't verify it works with the rest of the scripts as I'm having trouble with a seemingly separate problem with the Binance API and Google Docs. However, the code above is valid at least. You might have to edit the above URL with the correct end point as I'm not sure if the script expects "listings/latest". I'll update here if I get everything working correctly :).

@KZkici
Copy link

KZkici commented Jun 25, 2021

The code above works great thank you, however in my portfolio the Coins just have these symbols for values: ??????
Hoping this project gets updated :)

Thank you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants