Forum Academy Marketplace Showcase Pricing Features

!HELP! My API returns different headings when the URL parameter is changed, meaning the API isn't responsive to any parameter aside from the initialised one

Hi,

My API call returns different variables when the symbol parameter is changed. I think this is why I can’t make the API dynamic and show data for different symbols in a repeating group. I’m hoping someone can help me with an easy fix for this, but otherwise I may be forced to change the API data type to text from JSON and use regex to parse the coin id (which is all I need to pull the coin image file which is what I am aiming to do. The call is shown in the screenshots below:




These are two seperate calls made with two different coins (bitcoin and polygon). As you can see, the token symbol is infront of the returned id string (e.g. MATIC id vs BTC id). This means when I go to call the id, it will only work for the coin I initialised the API for. In the following case, the API only works for BTC because that is what the API was last initialised for. This is because the parameter description is BTC id and this doesnt match up to another coin (e.g. Ethereum would return ETH id as the parameter heading).

Does anyone know an easy fix for this? or is REGEX the only solution. I am unfamiliar with how to use REGEX so would like to use another method. Thanks

1 Like

You cannot use API Connector with this kind of Payload. You will need to use a different tool to parse this kind of JSON that use a dictionnary.
OR
You need to enter all possible API response manually and use conditionnal to display different information according to the reponse. But it’s not a good solution if you have a lot of different possible payload .

You can also consider a different API that may fit better.

1 Like

What kind of tools are available to parse this? I have a few other API calls with a similar structure that I cannot use an alternative API for.

I don’t know if there’s an existing tool actually for that in Bubble plugin. Probably there’s something possible with Integromat. I don’t know.

1 Like

@agoo7714 what does the coin ID represent? Does this change over time?

no, it stays constant. I am using a different API at the moment that isn’t as reputable but still does the job. WIth other API calls with similar structures I am experimenting with receiving the API in text rather than JSON and then using REGEX to extract the necessary data but it is a long workaround.

If I understood correctly, you’re using that call just to retrieve the coin ID which is then used to get an image file (I guess in a subsequent call). Is that right?

Just had a quick look at the API docs. Why don’t you just use the map endpoint (https://pro-api.coinmarketcap.com/v1/cryptocurrency/map) instead of info to get all the coins then use the symbol to search for the ID you need?

1 Like

Thanks, I have found a solution using REGEX but that is another solution that I will likely implement in the future.