# Connect to local web Server via Web API

**URL:** <https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878>\
**Category:** Questions about Thunkable X\
**Tags:** webapi\
**Created:** [January 28, 2021, 11:08am UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878 "2021-01-28T11:08:34Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giuseppe\_Geppo\_Catta](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@Giuseppe\_Geppo\_Catta](https://community.thunkable.com/u/Giuseppe_Geppo_Catta)\
**Post date:** [January 28, 2021, 11:08am UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878/1 "2021-01-28T11:08:34Z")

</div>

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](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?

 ![test_web_api](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/8/78e6888182aaa654dcd45894c44e861773c239be.png)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [January 28, 2021, 11:12am UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878/2 "2021-01-28T11:12:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Giuseppe\_Geppo\_Catta](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@Giuseppe\_Geppo\_Catta](https://community.thunkable.com/u/Giuseppe_Geppo_Catta)\
**Post date:** [January 29, 2021, 1:32pm UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878/3 "2021-01-29T13:32:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [January 29, 2021, 1:53pm UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878/4 "2021-01-29T13:53:27Z")

</div>

> [@Giuseppe\_Geppo\_Catta](#):
>
> 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.

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?

---

<div class="post-metadata">

**Author:** ![Giuseppe\_Geppo\_Catta](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@Giuseppe\_Geppo\_Catta](https://community.thunkable.com/u/Giuseppe_Geppo_Catta)\
**Post date:** [January 29, 2021, 2:35pm UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878/5 "2021-01-29T14:35:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [January 29, 2021, 4:58pm UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878/6 "2021-01-29T16:58:08Z")

</div>

> [@Giuseppe\_Geppo\_Catta](#):
>
> 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?

* * *

> [@Giuseppe\_Geppo\_Catta](#):
>
> It should not admit access from internet but only from the lan.

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)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [January 29, 2021, 6:11pm UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878/7 "2021-01-29T18:11:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Giuseppe\_Geppo\_Catta](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@Giuseppe\_Geppo\_Catta](https://community.thunkable.com/u/Giuseppe_Geppo_Catta)\
**Post date:** [February 1, 2021, 7:06am UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878/8 "2021-02-01T07:06:51Z")

</div>

I’m making some thests then i’ll let you know 😉  
Thank you for the moment 👍

---

<div class="post-metadata">

**Author:** ![good-starter432425](https://avatars.discourse-cdn.com/v4/letter/g/a8b319/32.png) [@good-starter432425](https://community.thunkable.com/u/good-starter432425)\
**Post date:** [January 20, 2022, 6:21am UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878/9 "2022-01-20T06:21:21Z")

</div>

need i a local webserver to connect phones via local wifi?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 20, 2022, 6:22am UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878/10 "2022-01-20T06:22:42Z")

</div>

Can you say a little more about what you’re trying to do? When you say “connect phones via local wifi” … for what purpose? How does this have to do with APIs? If it doesn’t, please create a new topic and explain in more detail.

---

<div class="post-metadata">

**Author:** ![good-starter432425](https://avatars.discourse-cdn.com/v4/letter/g/a8b319/32.png) [@good-starter432425](https://community.thunkable.com/u/good-starter432425)\
**Post date:** [January 20, 2022, 6:23am UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878/11 "2022-01-20T06:23:40Z")

</div>

i want to make phones sending data to each other using local wifi

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 20, 2022, 6:24am UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878/12 "2022-01-20T06:24:34Z")

</div>

Okay well I can’t be of help without knowing more about this. One sentence isn’t enough to figure out what you’re trying to do.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 1:30pm UTC](https://community.thunkable.com/t/connect-to-local-web-server-via-web-api/1072878/13 "2024-11-08T13:30:29Z")

</div>


