[API Connector] Issue with unexpected calls

Hey there all!

Recently I added a new GET request to retrieve info from my PSQL database, it takes in the argument ID and userID. To put some context in this GET request, it is supposed to only run for certain users but for some reason it gets called for all users and uses the default arguments I have set up when initializing it. I don’t understand why this API is getting called when the element is not even visible or accessible to the user.

So basically I am running into an issue where my API is getting called even when I don’t want it to. I checked my workflows and app for anywhere that calls this endpoint. I even made the element completely invisible (unticked element is visible on page load) and I am still getting API calls for the default values as the argument.

For some reason I keep getting errors on my error logging service, after some investigation I have pin pointed that whenever any user refreshes their page the API is called.

Would anyone know why the API is being called every time the app is being accessed?

Can you please share more details like where you are calling the API. Do you save the response in database or display in repeating group. Is your API is set to Data or Action in the API Connector? Please share screenshot of both API configuration and Editor Element.

If the API response is set to display in a repeating group (e.g. text element) and in API connector it is set to data. then every time API will be called on page load.

If this is the case then please change the API call to action, thus it will prevent the call on page load.

You can then use action like when a button is clicked API will be called. And only if the USER (e.g. Role is Premium) will see the button or group to work with API. (Conditional Visibility).

Thanks Kazimdgoni for the reply!
I have changed my API call to action instead and have it fill the element with data through the work flow instead. I don’t seem to be getting errors!

Thanks!

You are most welcome. Best wishes to your project :heart: