Getting API data into a Database

I am trying to get data from an API and put part of it in my Database.
The API data is coming from a service running on my PC.

The data shows up fine if I put the URL in a browser:

I start the API by fetching data with an API Action like this:

and fetch the schema which shows the data format:

But when I click the ‘open in browser button’ I get:

and I can’t find any way round it.
Can anyone see what I’m doing wrong?

Looks like port 8080 isn’t accessible. I’m not sure how to fix that, but here’s a Stackoverflow thread with some things to try -

To workaround, instead of localhost, you’d have to use another special domain provided by Docker to connect to your computer’s localhost instead of the container’s. You can consult Docker’s documentation to find about it depending on the operative system you use (Windows, MacOS or Linux)

Thank you for the suggestion.
I had thought that because the data was visible in the browser using the URL with port 8080, that was ruling out any issues with port 8080.

Also, on a page I have an API Data Source using a similar URL to the same service on 8080 that populates a Bootstrap table fine. The setup of the API Action above seems to have all the same settings as the API Data Source but just doesn’t work.

It can be confusing when using docker.

It works for you from the editor because the editor is outside of docker and goes directly to your localhost:8080.

But when you run it from the code, that is being done inside of docker and thus is not reaching the localhost of your computer, it is reaching the localhost of the docker container.

Try using


I think that works for docker desktop v18+

Thanks for your help.
I’ll give that a try later today.

Hi @mebeingken.
Sorry, I’m a bit new to Docker.
Is the idea that I put that code into the docker-compose.yml file like this:

I’ve done that and restarted Docker but still get the same error message.
Have I missed the point?

Sorry, I wasn’t clear. My idea (I have not tried this) was that you would replace localhost:8080 with host.docker.internal:8080 in the URL of your API Action.

Hi @mebeingken. That works perfectly!
Many thanks for your help.

1 Like