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