Hi all,
I’m trying to figure out if there is a way to return a datatype from the “server script” action. It clearly lets you pick a datatype that it is returning but I can’t get it to display that returned value in a group which is of the same type. See screenshots here:
But when I run the action, nothing shows up in the group. I have also tried a simpler version of this with just returning text and the group being of type text and that displays fine. It’s either one of two options:
Bubble doesn’t allow you to do this
The way I am formatting the data being returned is not formatted correctly
I don’t think you can return a datatype from Server Script. But what you can do is return the datatype’s unique_id. Doing this, you will just have to do a “Search For” in the front-end to have the same result
Thanks for your help here. The only problem is I’m trying to return an api connection data type, not an actual database datatype so there is nothing to do a search on. The obvious next question is then “well then why do you just call the api as you normally would in bubble?”. The reason is because the api is an autocomplete api (algolia) and connecting through the api connector has a short delay making it unusable as an autcomplete feature from a UX point of view.
The caveat is that you cannot implement any security in the call (i.e private key in the header) as that will now be available to the public. I am not concerned with security on this one (I doubt there’s too many people that want to access my algolia autocomplete api).
You can provide the authorization as a parameter and any other parameters you want, you just can’t hide them from the public. The only way to hide them is to run the api call server side. If you tick the box for client side, you will just have to set up the call slightly differently to have the auth in the parameters.
When I integrated algolia client side, I was able to perform it, it just means that you can see the api keys in the network requests:
Looks like I was incorrect. I was thinking you could send headers as parameters in the url but doesn’t look like you can. As soon as you try to add a header, you use the client side checkbox.