Fill dynamic URL variables from database in API connector action

Hi everyone,

I’m trying to integrate with an external REST API over which I don’t have control. It looks like so:

GET https://www.example.com/employee/[employee-id]/name

The part which is [employee-id] is dynamic, so I’m using squared brackets.

What I don’t understand though: How do I now fill the value dynamically from a field called “employeeId” stored with every user in my Bubble database? Of course I have to uncheck the “private” checkbox in my API call section, so much is clear. But how do I actually refer to the database field in the context of an action API call?

Did you try “Current user’s employeeid” in the workflow action?

Ho. Check if your api is defined in bubble as “data” or “action”. I think it should be data in this case.
Ciao.

Just tried it, unfortunately does not seem to work. :frowning:

Hm, changing it to data does not seem to solve the issue neither. It really seems that the url parameter is simply not filled, but I have no idea how to achieve that.

Ok, finally I figured out what the solution should be - in theory. Setting “action” is correct here, the problem is elsewhere.

Note that I MUST provide an url parameter as a value, otherwise the url collapses and is not valid. But I don’t want to set a static value, but rather resolve it dynamically within my workflow. So I need to uncheck the “private” checkbox, to make sure I can access that value from my workflow. Then, in my workflow I can set a workflow step “API Call”, where I say: “(param) employee-id = Current user’s employee-id”. Left-hand-side refers to the url parameter, right-hand-side reads from the current users’s database entry.

So far, so good. In theory, that’s the solution.

But it still does not work. And I don’t know if the problem now is with Bubble.io client-side caching of some sort, or server-side caching of some sort.

When I (re-) initialize the call in API Connector plugin, then I MUST provide a value for employee-id. As I said above, if I don’t do that, then the URL is invalid. But because I have a non-empty value now set statically, it might be that this value always overwrites the dynamically resolved value from my workflow. In this way, I could never obtain the correct server response.
Or, it might be that the server is genuinely doing something wrong, e.g. cacheing the last response rather than re-calculating the latest response, and thus always returning the same response as long as I have a static value set in my API as a url parameter.

Now the question is how I can find out what’s going on under the hood?