Forum Academy Marketplace Showcase Pricing Features

Extract data from HTML received from API


I have an API that returns the HTML of a page from another site, which is a profile page for a company that contains its name, address, phone number etc. The data elements I want are in the body of the HTML response.

I can pull the text of the body and put that into a data thing just now, but what i want to to is set up a backend workflow that calls the API, takes the body of the HTML as text and then run the toolbox plug into get data by element ID., extract the data set i want, add it to the database then throw away what I don’t want.

Using the Toolbox plugin i could do this by putting the API result into an HTML element on a page then extract the data i want through the element ID’s using a workflow, but I just want this to run in the background to automatically add to the database each time the API is run on a schedule.

Does anyone know of a solution to take the API result, hold it somewhere and then run the toobox javascript action such as bubble_fn_thisAPIcall(document.getElementById(‘thisID’).value); ? Maybe i’m over thinking this, i usually do!

Any tips would be greatly appreciated.

If all else fails:

Send the output via email here and get their response in an endpoint that you can build. Or use Zapier if you prefer.

1 Like

You can extract with regex Bubble function.
you can also probably run a Server side script using Toolbox (from what I remember)

1 Like

Thank you for the help! I did try the regex solution and it was usable but I eventually found a way to get a JSON output from the API call which makes it far more usable in my situation.

1 Like

Whenever I hear regex and HTML I think of this post’s top answer on stackoverflow: html - RegEx match open tags except XHTML self-contained tags - Stack Overflow

1 Like

Hi @thelowlykumquat . Would you mind sharing what solution you found? I am struggling with the same problem.