Connect to local web Server via Web API

Hi,
I’m trying to connect to a local webserver to test a webAPI.
I can connect to the API using browser receiving JSON results
This is the complete URL:
http://127.0.0.1:8080/SQL_Server_API/SELECT?QUERY=SELECT%20*%20FROM%20TF_UTENTI
AND this is the returned JSON string
{“error”:{“status”:false,“code”:0,“source”:""},“result”:[[“69”,“Name”,“password”,“login_name”,“Y”,“10”]]}

If I try to connect to this URL with thunkable in LIVE TEST I can get nothing from the url and I can’t figure out why.
What’s wrong with my code?

1 Like

You need to display status and error in a label to see the problem.

If status is any number other than 200 then there is a problem and error might give you a description of the problem.

[UPDATE]
I assume you are running it from the computer so you will not be able to run it from your mobile and most of the API servers fail to respond from the Web Live Test. Make sure your local webserver does work from the Web Live Test.

1 Like

I’ve Already done but no response, error or status at all.

The problem is only in Web Live Test from PC.
If i download the apk, and run it from mobile, all work good.
But this behavior prevents me from debugging the app.
Even the live app test from mobile is impossible 'cause I need to be connected via wifi to my LAN(without internet), but thunkable need to be connected via internet.

Make sure your local webserver does work from the Web Live Test

It doesn’t seems so. Are there any settings i can modify to make it works?

UPDATES:
Only sometimes , after a long time, I receive an error. It seems that Web live test make a request via https even if I use an http url

If you’re hosting this DB on a local server there are probably some internal security features preventing this.

This is why, when you install the app and you are connected to your local WiFi you are able to get a result from your local server.

If you change to mobile data you will get the same error/behaviour as you do with web testing (which is really the expected behaviour)

Have you considered moving your API to the cloud?

1 Like

The focus is that this should be an internal application. It should not admit access from internet but only from the lan.
But as I understand, Live test functionality use web to access resouces and so it’s blocked.
I really don’t know if it’s possible to move my API to the cloud, 'cause I developed it with LabVIEW

It’s a long time since I did any work in LabVIEW but I think this should be possible with the latest software?


Yeah, that’s a pretty legitimate security concern. I think the solution will involve opening ports while you are testing (higher security risk) and then closing them again when you have installed the app, since the installed version is working for you, right?

(And this is the main requirement? i.e. once the app is able to connect rather then once Thunkable Live is able to connect)

2 Likes

Yes, a good start is to open port 443 and see how it goes.

2 Likes

I’m making some thests then i’ll let you know :wink:
Thank you for the moment :+1:

1 Like