[Solved] Connecting to an API

Hey,

Web_api works only for some rare URL. The problem is present with Tunkable live on ANDROID 10 (Network request failed), but not with ANDROID 9 live and generated apk.

The following example shows one working url (public IP api) and one not working (public CLOCK api) :

https://x.thunkable.com/copy/904b56457ad38ae27254a10d7cab7246

Thanks for your help.
JM ROuchy

I’m having issues with the web API as well - even when using the app from a Thunkable tutorial (Countries Info App).

Whether I use Preview online or Live, the app crashes whenever I enter a country name and press the search button. In Preview, the screen just goes blank. In the Live app, it just returns “Something has gone wrong. Check your blocks and reset this page.” If I output the response, status and error data to a label, I get a blank response, a blank status and an error that says “The website or service provider you are trying to reach does not support HTTPS requests.”

Here’s a link to the Countries app that originally came from the YouTube tutorial. I’ve detatched the bulk of the code on the second screen, added a “debug” label, and written the API responses to that label so you can see the error. https://x.thunkable.com/copy/3cac341ddea2ac628d6d0c037fce60d3.

I have students trying to build this app, and they’re having trouble. This app used to work fine for me, so I’m wondering if something changed recently with Thunkable. Note that I can’t get the Thunkable weather app to work anymore either - same results as the Countries app.

@ronturcotte Your project works correctly in the Thunkable Live app on an iPhone. So I think the issue is trying to access the API through a published Web App, correct?

I haven’t tried it in IOS, but it doesn’t work in the live app on Android, nor using web preview.

You’re right. I get “Network request failed” when I preview this in Thunkable Live on an Android phone.

Any updates on this issue? It seems like a Thunkable bug, but it would be helpful to have confirmation. Of course, a solution would be helpful too. :slightly_smiling_face:

1 Like

I don’t think it is a Thunkable issue. I believe this is a permission issue. Some API services allows that the request comes from one specific address (origin) and the response is redirected to another address and some do not allow this is it might contribute in security and privacy issues. I think this is what is being experienced by Thunkable as a Web App and that Thunkable internally redirects the response to your app.

This is usually managed by API CORS settings.

[Additional Info]
Check this write up

5 Likes

So, why would it work on IOS and not on Android?

1 Like

It’s a browser specific. Check the article I included in the post.

Ah - I understand. Chrome confirms the issue as well - at least when I preview on the browser, I see a CORS error in the console. Now I’m trying to understand what changed - because this app used to work. I tested it on an Android phone before assigning it to students. I also had a working app with openweathermap, and that one doesn’t work anymore either.

Thanks so much for your help.

1 Like

Hey,

A Web_API call still working 2 or 3 weeks ago doesn’t works any more in the Thunkable Live app on ANDROID 10. Still working with Thunkable Live on ANDROID 9. And OK too with the preview.
It seems to have a link with the security accès, https OK, http not.

I have an URL that works ok on any browser in both mode http and https :
api.ipify.org/?format=json

Anybody can test with the followig link that the http access doesn’t work with live ANDROID 10.
https://x.thunkable.com/copy/c0d7cf3257a8dc86b24b3d4bfa51f741

Bug or not ?
Thanks

1 Like

Hey,
Thanks a lot, corrected with update version 264.

Regards,. JM Rouchy

4 Likes

My API problem appears to have been resolved with 264 as well.

3 Likes