Problem API Connector dynamic values

Hello Bubble community.

I’m working on an application that uses the Google Distance Matrix API to calculate the distance between two addresses entered by the user via Search Boxes (sb.depart and sb.arrive).

Problem encountered:**

  • The API works fine when I put static values in the API Connector (e.g. Dakar, Senegal and Mbour, Senegal).
  • But as soon as I try to pass dynamic values from the Search Box (sb.depart's value and sb.arrive's value), the API continues to take the static values into account, and does not update the distance dynamically.

Current configuration:**


In the API Connector, I’ve defined the URL Parameters as follows:

  • Key: originValue: [origin]
  • Key: destinationValue: [destination]

In Workflow :

  1. When the user clicks on “Confirm addresses ”, I update a Custom State with sb.depart's value and sb.arrive's value.
  2. I call the Distance Matrix API, replacing [origin] by the Custom State origine_temp and [destination] by destination_temp.

What I’ve tested:**

:check_mark: Test API with static values in API Connector → OK
:check_mark: Check that Search Box values are stored in App Data → OK
:check_mark: Check that API receives dynamic values → NO (always static values)

Questions for the community:

What’s the right way to pass dynamic values (Search Box) to the Distance Matrix API?
Do I need to change the configuration in the API Connector, or is this a workflow issue?
Do I need to add another step to force Bubble to update the values?
Thanks in advance for your help! :blush::rocket:

Can you share what you have set for the API Connector call?

I have activated :
Geocoding API
Google distance Matrix API
Geolocation API
Maps JavaScript API
Places API
Google Maps API
Time zone API
Maps Embed API

Screeshoot : i use the same api key

than you in advance for your help

no. I mean your API connector call settings. Where you put the dynamic value (state from your case) using Get data from API (from what I see in your screenshot) or actions workflow if you are calling the API using action instead of data.

Ok here are :

Did you check in inspector in debug_mode the value provided when you use theses settings? You can inspect each part of the request/response using the inspector.

Also, I recommend to remove any test value from API Connector if you don’t enable allow blank because Bubble will use this value instead.

Thank you, i fine it, the problem was in the workflow.

1 Like