API KEY USE (air quality app)

Hello, i'm trying to make an air quality measure app, with some add-ons like humidity sensor and bluetooth module. I saw some example here i tried them with my api key, i am putting the coordinates and i receive the error 1101 "unable to get a response with the specified URL" and i don't know how to make it...someone can help me? i'm using openweathermap

Welcome to the community, post a screenshot of your blocks and since this is your first visit in the community please read

this is the last blocks i tried from the another example from this community, but for the the person who makes it it works, and for me still getting the same error, i tried to reply there but that topic is closed so i created a new one maybe i can find the answer

This the original example discussion: Air pollution measure (Air Quality api's)

The first Text Block in your Web1.url should Block should contain http://api.openweathermap.org/data/2.5/air_pollution


Please see the original discussion.

There might be other issues, this is the first I noticed.

yes, i put this into the first text box: http://api.openweathermap.org/data/2.5/air_pollution
then the coordinates from my city, and then my api key and appear a message "code 400" nothing to geocode..

OK I understand, howeveer the Block you showed is not correct as you shared with us. I assume you changed it.

Possible other issues:

  • your globals latitude and longitude might not be appearing. Do a DoIt on the join Block. Rename those globals myLatitude and myLongitude to avoid possible confusion . I expect an error here

still getting the same error..

Use Do it to debug your blocks. Do you get latitude and logitude ? Do you get a response from that url you create in browser ?

For example

This works


i tried and i get my response in browser, with full information, but if i try to put in the first text box of url the site http://api.openweathermap.org/data/2.5/air_pollution?lat=47.1667&lon=27.6&appid=f535ad764624815541a9c5ea105240c8 it show me the 1101 error, and if i put the https://api.openweathermap.org/data/2.5/air_pollution it shows me that nothing to geocode message but, the marker on the map goes to the coordinates ..

i tried, the marker goes to the correct location but there is no info shown on the screen

You may have to use a Clock Timer with the Get to process the response if you have a slow Internet.

The airQualityReport is the 'captured' Web.GetText responseContent.

still the same " nothing to geocode"

  1. learn to use DoIt
  2. a simple app that extracts basic data using the api. It even runs in the emulator using your basic data, the Map component and a Marker.

  1. Parse the resulting json to extract the aqi (shown in green). The air quality index is as described in the original community discussion. Write your code to extract it however you want

The developer must provide the code to parse the json text. Add your api key, run the program as shown and report on what happens.

  1. Here are some resources to help you learn to use the AI2 tools. A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles

How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also look here http://kio4.com/appinventor/index.htm and here http://www.imagnity.com/tutorial-index/ for more tutorials.

Learn about components http://ai2.appinventor.mit.edu/reference/components/
and visit the Library http://appinventor.mit.edu/explore/library Help>Library on the MENU

Hi SteveJG.
I have used the same api (openweathermap)
It was working fine for a long time, BUT. I have from time to time... an Runtime error.
Index 1 out of bounds in list [].

And i want to redirect the error to a label (showed in the lower side of the capture). Servicio (DISPONIBLE)... TO NOT WORKING.

FOR manage this i used

And i was thinking... to add an IF then GET responsecode (different) =/= than 200. But doesn't work.

How can i could manage to don't show this error like that, and show it in that label.

if the error is because the app is not linking and it fails to return a 200, an if then else structure might work if your WIFI or data is not allowing you to link.

Your runtime error could be due to other issues. Check your code where you use a List too. You may have to increase the delay using your Clock too if your connection is slow as a guess.

1 Like

1- Thank you very much for your fast replay.
2- Sorry for my english, i am spanish talker.
3- The connection is not slow. I even have some problems from the pc loading the json from a browser and from other places too.
4- I fixed the if else component and i wish i will not have (Again) the same problem.

Again, i appreciate a lot your fast replay.

I have a question and i want to share with you, but i will write you direct if you let me. I asked a lot in different forums and no one can share a good point of view for the developing of 1 app i have in mind. It's about the developing a Geology app. But i have some serious obstacles, maybe many have the same as i.
Well.. Thanks again.

I am very glad to address your issues regarding your Geology app German. Please post a new topic and I will answer in the community.


Hi Again Steve.
I already posted...
Here is the link.

Only 1 user replay me. and i talk with Juan Antonio (from outside the post), because i follow his website too.
I understand this could be a complex app, and i understand the technical issues from the Geology side and by the way that isn't easy, but i FOUND NOTHING from the programming side.

I answered on your stereoplot link German.

Because this activity is very complex and no one has posted anything except for App Inventor. The StereoNet link I posted on your other topic and other tools are written with professional compilers and run on PCs.

Yes, I understand what you want to do; I am familiar with a stereo net and fault planes etc. :slight_smile: Here is my App Inventor stereo tool :cry:


Sorry, it is very incomplete.