Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong names of JSON objects in Main class (assignment 3) #42

Open
psmorandi opened this issue Jun 1, 2015 · 4 comments
Open

Wrong names of JSON objects in Main class (assignment 3) #42

psmorandi opened this issue Jun 1, 2015 · 4 comments

Comments

@psmorandi
Copy link

Instead of

    public final static String tempMin_JSON = "tempMin";
    public final static String tempMax_JSON = "tempMax";
    public final static String seaLevel_JSON = "seaLevel";
    public final static String grndLevel_JSON = "grndLevel";

should be

    public final static String tempMin_JSON = "temp_min";
    public final static String tempMax_JSON = "temp_max"; 
    public final static String seaLevel_JSON = "sea_level";
    public final static String grndLevel_JSON = "grnd_level";

See this return example from API: http://api.openweathermap.org/data/2.5/weather?q=Lima&units=metric

"main":{"temp":17.03,"temp_min":17.03,"temp_max":17.03,"pressure":866.88,"sea_level":1025.82,"grnd_level":866.88,"humidity":77},

@douglascraigschmidt
Copy link
Owner

Paulo, when running http://api.openweathermap.org/data/2.5/weather?q=Lima&units=metric we don't get anything with sea_level or grnd_level in it. Here's what we get:

{"coord":{"lon":-84.11,"lat":40.74},"sys":{"type":3,"id":154950,"message":0.3679,"country":"US","sunrise":1433153223,"sunset":1433206895},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"base":"stations","main":{"temp":9.52,"humidity":90,"pressure":1021,"temp_min":9.44,"temp_max":10},"wind":{"speed":1.54,"gust":4.11,"deg":32},"rain":{"1h":0.51},"clouds":{"all":92},"dt":1433158525,"id":5160783,"name":"Lima","cod":200}

How are you getting these values?

Thanks,

Doug

@psmorandi
Copy link
Author

Hello @douglascraigschmidt, sorry I think I put the value from another query that I did. The weird thing is that this URL http://api.openweathermap.org/data/2.5/weather?q=x&units=metric gives this info. If you change x with Taypano (with seems to be the city) gives 404.

Here the full json:

{"coord":{"lon":124.56,"lat":8.37},"sys":{"message":0.9566,"country":"PH","sunrise":1433107334,"sunset":1433152618},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"base":"stations","main":{"temp":21.68,"temp_min":21.68,"temp_max":21.68,"pressure":957.98,"sea_level":1023.41,"grnd_level":957.98,"humidity":100},"wind":{"speed":1.96,"deg":155.002},"rain":{"3h":4.165},"clouds":{"all":88},"dt":1433165003,"id":1684361,"name":"Taypano","cod":200}

@douglascraigschmidt
Copy link
Owner

Paulo, can you please send me a link that demonstrates this behavior. This link gets 404 http://api.openweathermap.org/data/2.5/weather?q=Taypano&units=metric, as does this link http://api.openweathermap.org/data/2.5/weather?q=x&units=metric.

Thanks,

Doug

@psmorandi
Copy link
Author

Strange, see this picture:

image

This is the return for me of the second URL (http://api.openweathermap.org/data/2.5/weather?q=x&units=metric).

Could be browser related?

Try this one: http://api.openweathermap.org/data/2.5/weather?q=Umuarama&units=metric the city where I was born :)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants