How to return data from API Call?

Hello,

I am making an API call, and it successfully goes through and returns data.

How do I use this data?

In my instance, it is returns image URL’s and I want to show these image URL’s on my page, but don’t know how to access the returned data to show these images in an element.

Thanks.

If you are making this API call from the frontend, then you can get the Result of step [your api call step #] and show that in a custom state.

If you’re scheduling a backend workflow, then that is doing your API call then it gets a little more complicated since Bubble doesn’t support returning values internally yet…

Yes, I’m making the call from the frontend.

Once the call is made, is returns these images, I am doing this in Bubble edit mode.

image

But, how do I gets these links to show up as images on my frontend?

I tried doing the Result of step1 – yet no option to set anything as custom state.

You would do the “Set state of an element” action after your API call, pick an element and make a new custom state (text, list). Then what options does it give you after Result of step? It should have output

1 Like

Okay, I set the element state and set the after step 1 to output.

However, not sure where to go from here, no option in the dropdown get that link to show up as the image.

Wouldn’t you just put a repeating group on the page and make the source of the repeating group the API response?

1 Like

This is what I thought too,

but under data source, I don’t find anything to trigger the output of the API that I need

nvm figured it out thanks

1 Like

That’s the way to go. Make it a “Data” call and put that thang in a RG.

What did you do here? I’m running into the same issue and from what I’m reading you actually have to call your own API via the API connector - is this what you did? If you found another way I’d love to hear it!

Yes, I called the API I’m using on the API Connector.

Then I followed @tylerboodman 's steps to retrieve the output data from the response of the API call and used that data to load the image I needed

1 Like