Help with Dolar Price API

Asked Nov 21, 2023·1 reply·Last activity 2 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.

I has this API: https://dolarapi.com/v1/dolares/blue
today its returns: {"moneda":"USD","casa":"blue","nombre":"Blue","compra":905,"venta":925,"fechaActualizacion":"2023-11-14T19:54:00.000Z"}

but im only need the "compra" and "venta" info.
How can I catch it with the nightbot?

1 reply

Hey @Stellar Duck!

The API returns a JSON object, so you just have to read its keys:

$(eval const response = $(urlfetch json https://dolarapi.com/v1/dolares/blue); `Compra: ${response.compra} | Venta: ${response.venta}`;)