How do I connect to this API on Android

Hi,
i have a very weird problem, I have made an app to find vaccine slots and i am using this api. I usually test using “Preview as responsive web app” and everything works fine. But when i downloaded, the app crashes when i choose “select state”. After a lot of debugging i figured out the problem, the response is giving me error 403. I tried the same thing in my linux terminal (using curl) and i got the same error. It works if i use preview as responsive web app on that phone. Now since android is also linux, is that why i am getting the same response? And how can i fix it. attaching the screenshots and copy of my project.
error:

ERROR: The request could not be satisfied

403 ERROR

The request could not be satisfied.


Request blocked. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.

Generated by cloudfront (CloudFront)
Request ID: krk4bGENoj-M6BZe5plGTbjeLHBLDiAdDL4h9J22BkaL6rVgawr4qg==

Project link: click here

Note: What i got as an error was html code, it seems like thunkable has done all the work and displayed the output.

3 Likes

This is a server side error. First try to run the API URL direct from your browser and see if it works successfully. If this does nor support direct URL then test it with any API tool that can support curl format.

If it works through the browser or the API GET tool then you can debug the Thunkable project.

1 Like

Thanks for the reply @muneer .
Do you mean run the web app on my browser, if yes then it works like a charm and i also when to the page with the JSON to check that it shows up. Like i said before it works great on the web but when i test it on the phone (even live test) it doesn’t work. I don’t have access to an ios device so i don’t know what happens there.

1 Like

If you generated the web app link and you are certain it works as a web app then send us the web app link that you generated to see if it works. Most APIs will work from the phone but not from the web but yours could be a special case.

I am not a PRO member so I can’t generate a link, but you could always got to my project and live test > preview as responsive web app. Project link here

1 Like

This is the result when I tried it from the web.

image

Oh that’s odd, when i try it works ill attach screenshots



The problem could also bee because you aren’t in India?

1 Like

No I’m not. If this is the case then you better wait for an experienced Indian Thunkable developer to suggest s solution.

1 Like

Yep, I get this error for your States url (also not from India):

1 Like

Ya then i guess it is a non-india problem, but that doesn’t quite explain why when i live test / download it it doesn’t work. This is the real data.

1 Like

Check it on a different computer or at least a different browser just to eliminate the possibility that you accessed the API server and the app is using a cached registration info in the browser.

I tried that to, on the phone which has the live test app, I am able to see all the json data in raw format, not formatted like the above one which firefox created. Also on the api link i gave, in each api it has a try it out feature, could one of you’ll who aren’t from india try it out and see if you get that error? While trying it out remove hi_IN from the textbox or it will return TypeError. Api Link here

1 Like

I tried the API test buttons and it returns the same error I posted above.

1 Like

Then it must be because none of you’ll are in India, I guess i’ll have to wait for an indian thunker.

1 Like

@tatiang @muneer I need some more help, not with the web api, but with a label on my last screen, the label has a lot of text and it exceeds the screen but i set scrollable to true and also looked at other topics, I saw @tatiang’s question and tried using a buffer but it didn’t work. I will attach screenshots.

1 Like

Use the alert component. It will scroll automatically.

Alert component? I wanted the user to view the data and then can go back to the previous screen. Alert is kind off small isn’t it?

No didn’t work perhaps @domhnallohanlon or @jane could shed some light. This is what happened -

1 Like

I believe the structure of the output lend itself to a list viewer or data viewer list. You just have to parse it through a loop.
It is already by date as I can see from your screen shot, so you can view the dates in a list viewer and when the user clicks on a date you would display further info in text labels.

You can send the JSON response here or provide it in a text file if you want detailed info on parsing it.

@muneer what you are actually seeing is parsed data, this is what i used to get it, i am not sure if you will be able to see it clearly because it is a lot of code.
image
Unparsed data:-
{“center_id”:596452,“name”:“Vanivillas Hospital 1”,“address”:“VICTORIA”,“state_name”:“Karnataka”,“district_name”:“BBMP”,“block_name”:“West”,“pincode”:560018,“lat”:12,“long”:77,“from”:“09:00:00”,“to”:“13:00:00”,“fee_type”:“Free”,“sessions”:[{“session_id”:“74692fb5-0f25-47e5-8744-35e53cc9c2eb”,“date”:“18-05-2021”,“available_capacity”:0,“min_age_limit”:45,“vaccine”:“COVISHIELD”,“slots”:[“09:00AM-10:00AM”,“10:00AM-11:00AM”,“11:00AM-12:00PM”,“12:00PM-01:00PM”]},{“session_id”:“c0507968-cdaa-4a97-b8cd-ea9a40d608f4”,“date”:“19-05-2021”,“available_capacity”:0,“min_age_limit”:45,“vaccine”:“COVISHIELD”,“slots”:[“09:00AM-10:00AM”,“10:00AM-11:00AM”,“11:00AM-12:00PM”,“12:00PM-01:00PM”]},{“session_id”:“8f935a67-9434-4ea6-9e31-81726c290c4b”,“date”:“20-05-2021”,“available_capacity”:5,“min_age_limit”:45,“vaccine”:“COVISHIELD”,“slots”:},{“session_id”:“25c55a33-9908-480a-bf55-0bfb03f8295c”,“date”:“21-05-2021”,“available_capacity”:0,“min_age_limit”:45,“vaccine”:“COVISHIELD”,“slots”:[“09:00AM-10:00AM”,“10:00AM-11:00AM”,“11:00AM-12:00PM”,“12:00PM-01:00PM”]},{“session_id”:“c31f7e4b-22f4-4b6b-b474-aa1c1e124068”,“date”:“22-05-2021”,“available_capacity”:0,“min_age_limit”:45,“vaccine”:“COVISHIELD”,“slots”:[“09:00AM-10:00AM”,“10:00AM-11:00AM”,“11:00AM-12:00PM”,“12:00PM-01:00PM”]},{“session_id”:“d52d80b0-fdb3-4a74-9333-955d30cd6438”,“date”:“23-05-2021”,“available_capacity”:0,“min_age_limit”:45,“vaccine”:“COVISHIELD”,“slots”:[“10:00AM-12:00PM”,“12:00PM-02:00PM”,“02:00PM-04:00PM”,“04:00PM-05:00PM”]},{“session_id”:“217c17cc-e6e1-432b-8f0a-e5ec06f32035”,“date”:“24-05-2021”,“available_capacity”:0,“min_age_limit”:45,“vaccine”:“COVISHIELD”,“slots”:[“09:00AM-11:00AM”,“11:00AM-01:00PM”,“01:00PM-03:00PM”,“03:00PM-06:00PM”]}]}

1 Like

Check this quick app

https://x.thunkable.com/projectPage/609a6583e0bf0306cc8b9dbf

2 Likes