Good evening,
I’m trying the free API service. Everything works fine. I would like some information: does the free service allow you to collect information only on the first 100 cryptocurrencies? Importing into my database doesn’t give me an error but I can’t get it to import more cryptocurrencies. I also tried setting the ‘limit’ value. How can I do? I use php and curl
Hello Fabius!
With the free API you have access to all coins. The only difference between the free plan and the paid plans is the amount of coins you can fetch per request. With the free plan you can fetch a hundred coins per request, with the paid plan you can fetch 5000.
If you need to fetch coins other than the first 100 coins, you need the ‘offset’ parameter. It works like this:
https://api.coinranking.com/v2/coins?offset=50
This means that you skip the first 50 coins. The default amount of coins (i.e. the default limit
) you get is 50. You have already discovered the limit parameter, and you can set it to 100 with the free plan. So it would then look like this:
https://api.coinranking.com/v2/coins?limit=100&offset=100
That way, you fetch a hundred coins, starting at the 100 one. If you need more coins, just execute another request, adding 100 more each time:
https://api.coinranking.com/v2/coins?limit=100&offset=200
https://api.coinranking.com/v2/coins?limit=100&offset=300
https://api.coinranking.com/v2/coins?limit=100&offset=400
...etcetera