Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Coingecko links properties can't be accessed

I’m using the following way to access a property on coingecko’s API:
https://api.coingecko.com/api/v3/coins, this returns all crypto coins and their properties.

While using the above link I can access the IDs of any object in the response. but if I’m using the next link:
https://api.coingecko.com/api/v3/coins/bitcoin I’m still getting the ID as I can see in response, but I can’t access the id like this: data[index].id (which I can do with the first link).

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The second rest call returns an object, whereas the first link returns an array of objects.

To access id in the second example, simply use data.id (no array, so no index here).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading