Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Weather App (2015) Exploring an API The Forecast API

cesarruelas
cesarruelas
27,718 Points

API request modified for Celsius degrees

Anyone tried to get the info in Celsius instead of Fahrenheit? I've read the API Docs and I know I'm supposed to append "units=si" somewhere in the request but I just can't seem to figure out where. I've tried at the end prefixed by a &, prefixed by a comma, with and without brackets... Nothing seems to work

Jeremiah Shore
Jeremiah Shore
31,168 Points

You can always use a formula to convert the Fahrenheit value to Celsius.

(°F - 32) x 5/9 = °C

Definitely not the same but always a viable option. I'll look into getting you a "real" answer though ;)

1 Answer

Jeremiah Shore
Jeremiah Shore
31,168 Points

you just need to append ?units=si to your Request URL

https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE?units=si
Jeremiah Shore
Jeremiah Shore
31,168 Points

Options The API request may optionally be modified through the use of query parameters.

you start them with a '?' then separate them with '&' like so: ?units=si&exclude=minutely

cesarruelas
cesarruelas
27,718 Points

Thanks, this worked perfectly