Trigger API with button click

I want to “refresh” an API call on a button click, to get a different value from the API. Taking the “Using external APIs” Lesson as an example. In that lesson, the API will show the iTunes search results when the text in the input is changed. Instead, I want it to only show search results when a button is clicked. How would I do this?

Thanks!

Have you tried a workflow?

Yep. Same as you’d do anything else triggered on a button click.

Make a button. Set up its properties.

In the properties window for the button, you’ll bee a button “start/edit workflow”. Click it. Build a workflow that happens on click.

BTW, for more on using APIs, @joshua.hovden, you might be interested in the very recent Bubble webinar on the API Connector. The first part covers some basic API Connector setup and use of external APIs in a project.

The second part covers oAuth authentication and login (enabling a new login method for your users based on authenticating to another service — in this example case, LinkedIn).

Along the way, you’ll see @neerja do a bunch of typical Bubble stuff. Just seeing THAT might be helpful to you in getting going with some of the Bubble basics.

LINK: Todays api webinar

2 Likes

Was the webinar recorded? @keith

Derp! Just edited the link back into my reply. Duh.

1 Like

Thank you very much :grin:

In the workflow, you can call the data from the API


then

1 Like

Thank you so much! Appreciate it.

1 Like

For anyone else struggling with this - I found another way of doing this:

E.g. I was trying to set a video’s videoid to only show up after a button click. I did it like this:

  1. Create video item
  2. Create button
  3. Create button workflow
  4. When button is triggered, set a custom state
  5. In the custom state - display dynamic data - In there do your api call
  6. Video options - dynamic data - search for the element’s state in there.
1 Like