javascript command not working

Asked Apr 7, 2021·1 reply·Last activity 5 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

here is the command I am trying:
$(eval var api = $(urlfetch json https://rest-sandbox.coinapi.io/v1/COINBASE_SPOT_ETH_USD/current?apikey=x); var obj = JSON.parse(api); obj.bid_price; )

It is supposed to return the price of ETH, and it does get data from the API call but it doesnt parse it, it just returns "unknown identifier"...this code works elsewhere just not in Nightbot, what am I doing wrong?

1 reply

Hiya, you sure the url is correct, would expect something after /v1/?
Can't really test it out without an API key, but dont see this endpoint in their docs.