Dynamic API Parameters from Database

Hello dear Bubblers!

I was hoping someone might be able to give me a pointer in the right direction on this one please?

I have an external API that i call to get account details back for each account number I send to it. The API is set up in the API Connecter with the parameter being public so that I can pass that information dynamically. The API is set up as an Action which I call from a scheduled backend workflow, the first step of the workflow calls the API, the second step then assigns the data that comes back from that API call to the database, and that all works fine.

The problem I have is that the account numbers I need to use for the API parameter are stored in the Database under their own Data Type (Master Account Numbers) and their own Field (MACC No).
In the Workflow for the API call action I have given the path to find the MACC No to use as a parameter by searching for the the type and then the field. (see image below)

However I cant get this to work the way I need it to. What happens is, if there is one MACC No in the data type the API call picks that, uses it in the API call and I get the information I expect back and the workflow stores it to the database where I need it to be stored. Which is what I I expect, but as soon as I have more than on MACC No the API call doesn’t select any of them and calls the API with no parameter, which gives no data back. (I can see the request at the other end in the external endpoint which has the information I am requesting).

In reality the Master Account Number field will have hundreds of MACC No’s, and I need to work out how to get the back end work flow to take the first MACC NO, make the call, process the data then move to the next MACC No and repeat until all the MACC No’s have been processed. the intention is to run this workflow once a week on the MACC No’s.

I’m think I could use @Gaurav Bubble Developers Kit for the List processor or @evanlitttle loop function (https://www.youtube.com/watch?v=OI1-4SvAl3M) but my experiments with that have failed…

Am I missing something obvious? I tend to over think these things sometimes! Any help would be greatly appreciated!

1 Like

Ignore me, managed to get evans loop system to work, I was being thick and missed a step! Many thanks for the tutorial @evanlitttle !!

Is there not a major security flaw somewhere in the process here? Your keys can technically be exposed on the Client’s browser or inside the JSON for the swagger API.

Perhaps an idea to custom code the script in Node? I might be able to help out on that part if needed =)

If by Key you mean the MACC No I mention above then that’s not really an issue as these are publicly available licence numbers available through a variety of EU regulatory websites.
The actual Key for the API is handled in oAuth. This particular API will be run in the background, server side, once a week to update the database details and will be behind privacy rules and no public endpoint.

But I may take you up on Node coding in the future! :wink: