Call our own api endpoint

i have to call one api endpoint.my api running in local.
its giving error network timeout but as in doc its working in postman noy in retool.
http://localhost:8080/api/*

1 Like

Hi! Thanks for the question. Retool runs all queries through our backend which is on our server (and not on your computer). So unfortunately you aren’t able to ping endpoints running on localhost.

However — a good workaround is ngrok, which will expose your local webserver on a public url: https://ngrok.com/

2 Likes

LMK if that works? Thanks!

Nope its not working…Is in any way to do this. Can u explain how post api works in retool.
and how to connect our own api url to retool.

ngrok is working.

Try localtunnel. We use that. https://localtunnel.github.io/www/
After running your server on localhost:8080, in a separate terminal, just do: lt --port 8080, and a url will be returned. Simply use that url in your REST API resource in retool

is this still the case? Does Retool always require a hosted server for the APIs?

Hi @devonso!

This is, indeed, still the case. We now have a callout for it in our docs but the workarounds of the kind mentioned here by David.

I can hit localhost endpoints from within a custom component (just using fetch) - I used this to integrate with a connected DYMO label printer, works fine for me - Might be applicable for some other use cases too.

1 Like

related to Can you use a localhost REST API server?

【feature request】Can Retool create a agent like postman agent?

When I installed the agent, the REST resource forwarding traffic to my local api ?

Is this solution possible?

this will facilitate local debugging api, my retool is self hosted and cannot access the public network (ngrok, localtunnel)

Hey @jk2K! Is your API hosted on the same network as your Retool deployment? If that's the case, I think it should be reachable. Most requests made from Retool aren't made directly from the browser, they're made from the db connector service which, for cloud orgs, is hosted by Retool, but if you're self-hosting then you have control over what network the service is on and what it has access to.

I am able to deploy my API on the same network as My Retool deployment. this approach can solve problem.

also, I have an idea, is it possible to realize it?

the requests made from Retool are made from the Retool db/api connector service, not browser, same as before

the trick is

I installed Retool agent on my computer, the request is actually using Retool agent to access my localhost api

:thinking: I'm not sure! In my experience, people who deploy Retool have a variety of different networking setups so you may be able to configure something like this. Is there a particular reason you're looking to use websockets?