Change value of URL parameters for API get call

Hello Bubblers!

I’m new to using data APIs and can’t figure out what I’m doing wrong.

How can I change the URL parameters [cur1] and [cur2] so that the API can convert other currency pairs? When I change them manually or based on a dropdown selection, nothing shows. It only works for the currency pair EUR-USD.

Just click where you have USD and change it. You can use dynamic value.

That’s what I assumed as well. I’ve tried both changing it dynamically and manually, but nothing happens.

When I set “(path) cur1” to JPY (Japanese Yen), nothing is displayed.

Have a look at your log after your call to see what call have been made. You can also use run step by step or inspect element to see your call. Can you share a screenshot of what you have tried?

Thanks for the tip! I had a look at the server logs and the correct HTTP request and HTTP request response body are fired.

The value for each response is shown this way (and the currencies are changed dynamically and successfully using a dropdown selection):
“USD_SEK”: {
“val”: 9.32725

Below are two screenshots to better illustrate my problem.

API settings:

I think that the issue is that I have to add " 's USD_EUR val", which is the value of the URL parameter [cur]. Even though I change [cur]'s value dynamically based on the currencies that are selected from the dropdown menus, the conversion rate won’t display unless the value matches the original value (USD_EUR)

If you don’t have a lot of different combination of currency, you can create the payload yourself.
But I guess you will have a lot.
Idea 1: change API. (endpoint or service.) Some may be easier to use in API connector.
Idea 2: instead of using JSON, get the data as TEXT and use js tool or regex to parse result.

Thanks again @Jici!

I got the data as text and parsed it using regex, which did the trick.

My next problem
I will connect my app to money transfer providers, such as TransferWise and TransferGo, and for those API connections, parsing the result is not an option.

I want to build something that’s similar to this page:

To achieve this, I need to be able to change the API parameters dynamically.

For instance, the API parameter that’s named [amount] should be changed when the user enters an amount and presses “refresh”. How do I achieve this? To dynamically change the parameter to the value of an input field was my first idea, but for some reason that doesn’t work.

I’ve looked for tutorials on this topic, but I’ve come up empty-handed.

Perhaps, this could work:

  1. Instead of using Bubble’s API connector, I could schedule an API workflow on button click
  2. Send relevant parameters (dynamically) to the API workflow
  3. Return data to API (?). If this is a correct way to do it, then how do I print what the API returns on the page?

There’s different way to do that. But one thing you should consider is to use state. You will store the result of the first request into the state and you will be able to reuse it somewhere else.