Weather prediction is complex. There are umpteen parameters to track, whose permutations and combinations lead to thousands of possible outcomes. Thankfully, there are APIs that abstract away all that complexity behind the scenes. In this overview I will cover the basics of Dark Sky API.
Dark Sky Weather API is an easy to use weather API to get instant weather predictions. It supports both current and historical predictions.
This API supports two endpoints
The “Forecast” endpoint fetches the latest weather prediction for a given geographical location pointed by a latitude and longitude coordinate.
This “Time Machine” endpoint is similar to the “Forecast” endpoint. In addition to the latitude and longitude, it accepts a timestamp to retrieve the historical prediction.
Both endpoints support optional parameters to fine tune the prediction responses from the Dark Sky Weather API.
- lang - The ‘lang’ parameters returns the data in your preferred language. You can check out the supported languages under the “API Details” tab. This parameter is not available for the “Time Machine” endpoint.
- extend - The ‘extend’ parameter is used to return extended results for the interval forecasts. In the case of a value ‘hourly’, the API returns the forecast with extended prediction for the next 168 hours (7 days).
- units - The ‘units’ parameter is used to select a specific unit for the weather parameters. The “API Details” tab has more information on the supported units and their interpretation in the returned response of the API.
- exclude - Finally, the ‘exclude’ parameter is used to omit one of the data blocks from the API response, either “currently,” “minutely,” “hourly,” or “daily.” It also accepts a comma-delimited string containing more than one data block.
The requests cost $.0001 each. The API offers a free quota of 100 requests a month.