I'm using the Dark Sky Forecast API to retrieve some weather information.
When I read the official doc, I found that the "option" section describes the usage of query parameters.
For example,
The API request may optionally be modified through the use of query parameters. It will respond to the following:
callback=[callback]: Return the API response as JSONP. Please use caution when using this, since exposing your API key to the public is a security hazard and, if abused, will result in the revokation of your API key. However, if developing a personal- or internal-use app, this is a convenient method of doing so.
units=[setting]: Return the API response in units other than the default Imperial units. In particular, the following settings are possible:
us: The default, as outlined above.
si: Returns results in SI units. In particular, properties now have the following units:
...
I know how to get the weather information by take advantages of the call
https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE
But I don't know how to combine the query parameters with it.
Any ideas?
2015/10/23 UPDATE
Thank to Logan Kearns, using ? parameter solved my question. Make sure the query parameters are in lowercase.
https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE?lang=zh-tw&units=si
The app pulls real time radar data from the National Oceanic and Atmospheric Administration (NOAA)'s National Weather Service (NWS) which operates 140 doppler radar stations across the United States.
About the Dark Sky Weather App Available only for iOS devices, the Dark Sky weather app has provided “the most accurate source of hyperlocal weather information” and “down-to-the-minute forecasts” since 2018.
Using the Dark Sky API, there are two ways you can achieve this. You can either take the hourly or daily forecasts provided with the current forecast returned from the “GET Forecast” endpoint. Alternatively, if you want to consider a more extended range, then “GET Time Machine” is your best friend.
To visualize weather patterns, you first have to build a dataset to accumulate weather data for a range of days. Using the Dark Sky API, there are two ways you can achieve this. You can either take the hourly or daily forecasts provided with the current forecast returned from the “GET Forecast” endpoint.
It’s time to do a test run of the Dark Sky API. Select the “GET Forecast” endpoint within the API console. Enter the values for the ‘latitude and ‘longitude’ parameters as shown, and click the Test Endpoint button. This triggers the API to return the current forecast for New York City, as defined by the location coordinates.
The weather API communicates the weather status as words like clear-day, clear-night, rain, snow, sleet, wind, fog, cloudy, partly-cloudy-day, or partly-cloudy-night. We have a folder with all these words as images.
This is how you change the units. I assume that other query parameters would be set in a similar manner, using the '?' to separate them.
https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE?UNITS=us
Just an update, since url changed and with few other parameters:
You can add units to mention the type of unit conversion required You can add exclude for excluding certain data in the response like hourly updates.
https://api.darksky.net/forecast/APIKEY/LAT,LONG?units=si&exclude=minutely,hourly,daily,alerts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With