Beginner's question : API calls

Hello,

I’m trying to use Coinranking’s API to train on my Vue.js new skills and I’m trying to create a form where you can search for coins by names (using axios).
I’m currently able to access all data and seeing the documentation it doesn’t seem to be possible so simply. It seems you can only look for a coin using its “id”.
Is there a way to search by name without having to manually associate names with ids?
Thanks in advance for answers and sorry for the beginner’s question that may seem dumb.

Cheers,

4 Likes

Hi @JStephens83,

Cool that you’re using our API for that!

Are you already using the v2 version of our API? Check out the documentation here.

You can do that with the Get search suggestions endpoint.
With that endpoint you could pass down a coin name or symbol and it will return the 5 best results, with an added bonus that it will return exchanges and markets too.

The search-suggestions will return the uuid of a coin, as well as the name, symbol and the icon. With the uuid you can get more info on a coin through the Get coin endpoint.
For example if you want to search on Bitcoin you could query the search-suggestions like this: https://api.coinranking.com/v2/search-suggestions?query=bitco
And get more info by using the uuid like this: https://api.coinranking.com/v2/coin/Qwsogvtv82FCd

Let us know if it works out! :slight_smile:

Have a nice day!

4 Likes

Hi @nickpater,
No I’m not using the V2 version (though that since it was a beta it may not be very stable yet), I guess I will since what you are suggesting seems to fit perfectly to what I’m trying to do!
Thanks a lot for your quick answer I will get down on it quickly and will let you know!

Cheers,

2 Likes

Well… After many attempts to connect to the V2 API I’m hitting a wall.
The documentation here says the Authentication to the API is performed via a custom HTTP header. I’ve tried setting up those headers (I got my API key) in many ways (using axios’ documentation as well as other resources) but keep getting CORS issues, the main one being “Access-Control-Allow-Origin header is missing” (translated from French) followed by a network error.
So I’m still much of a beginner in this field and looked for answers but it seems to me that this header is supposed to be set on server side (which I don’t have access to of course) and not client side.
I’m developing on localhost for the moment, but I don’t know if that has anything to do with it.
:sob:

1 Like

@nickpater I also tried deploying in production and previewing locally but am still having the same issues…

This is going to be my logbook lol.
I was able to solve my issue by using a proxy, link to my stackoverflow thred

Hi @JStephens83!
We’ve enabled CORS in the All You CanEat package, but for the Free package using a proxy server is the right thing to do! :+1:

2 Likes

@nickpater, I’m facing cors issues with you guys api even after paying for a plan, no access allow origin issue using vue, any way to help