What Happened to the Dark Sky API?
Dark Sky was acquired by Apple in early 2020, and the API is no longer accepting new signups. Existing users can continue to use the API until the end of 2021. For more information, see the update posted by Dark Sky.
Will the Dark Sky API Still Work?
For existing API users, the Dark Sky API will still work until the end of 2021. However, if possible, we recommend switching over to a Dark Sky alternative.
Using an alternative API is encouraged because the deprecated Dark Sky API will likely not be updated, and it will be more difficult to find answers or support for problems that arise when you use the API.
Dark Sky API Alternative: AerisWeather
AerisWeather is one Dark Sky API Alternative. You can also browse our Weather APIs category for alternatives.
How to Transition from the Dark Sky API to the AerisWeather API
Step 0: Setup a RapidAPI Account
If you don’t already have a RapidAPI account, you will need to sign up for a free developer account which should only take a few minutes.
Step 1: Subscribe to AerisWeather and Make an API Request
Navigate to the AerisWeather API Pricing page. The API has several different pricing plans available. For most developers, the Basic plan on AerisWeather should be very comparable in function and price to the Dark Sky API. You can always upgrade to the Pro, Ultra, or Mega plan in the future.
Once you have subscribed to the AerisWeather API, you can return to the Endpoints page. We recommend testing an endpoint to make sure the API is working properly. Select any endpoint under the Basic Access dropdown, and click the Test Endpoint button.
When you see the 200 status code, you will know your subscription and the API are both working properly, and you are ready to integrate the API into your application.
Step 2: Change your Base URL
If you were previously using Dark Sky, you will need to update any instance of:
dark-sky.p.rapidapi.com
to AerisWeather:
aerisweather1.p.rapidapi.com
You can easily transition from Dark Sky to AerisWeather by using the code snippets on RapidAPI. You can generate these code snippets in any language and for any endpoint. Using the code snippets also ensures your base URL and request headers are updated correctly.
Step 3: Identify What Endpoints You Need to Update in Your App and Transition to AerisWeather
Another benefit of using AerisWeather is the detailed documentation available on their website. The documentation includes Common API Queries like current air quality, heavy air quality, current conditions, and more. Note that many of these require premium access to the API.
Below we have also come up with a few common scenarios that you may have been using the Dark Sky API for, and the AerisWeather endpoint you can use as a replacement. You can use the code snippets below, or generate your own in your preferred language on RapidAPI from the AerisWeather endpoints page.
1: Fetching Current Weather Conditions for a Specific Location
If you use Dark Sky to fetch weather conditions for a specific location, you are likely doing so with the Forecast endpoint. The response includes current weather data for the specified location like time, summary, temperature, wind speed, and more.
"time":1586995149 "summary":"Clear" "icon":"clear-night" "precipIntensity":0.0061 "precipProbability":0.01 "precipType":"rain" "temperature":10.33 "apparentTemperature":10.33 "dewPoint":4.33 "humidity":0.66 "pressure":1017.4 "windSpeed":1.22 "windGust":1.87 "windBearing":85 "cloudCover":0 "uvIndex":0 "visibility":16.093 "ozone":359.9
You can retrieve very similar data from the AerisWeather API using the Current Conditions endpoint. The response will include very similar information to Dark Sky, including time, weather, temperature, and wind speed.
"timestamp":1586993400 "dateTimeISO":"2020-04-16T01:30:00+02:00" "recTimestamp":1586993722 "recDateTimeISO":"2020-04-16T01:35:22+02:00" "tempC":13 "tempF":55 "dewpointC":0 "dewpointF":32 "humidity":41 "pressureMB":1016 "pressureIN":30 "spressureMB":995 "spressureIN":29.37 "altimeterMB":1016 "altimeterIN":30 "windKTS":4 "windKPH":7 "windMPH":5 "windSpeedKTS":4 "windSpeedKPH":7 "windSpeedMPH":5 "windDirDEG":110 "windDir":"ESE" "windGustKTS":NULL "windGustKPH":NULL "windGustMPH":NULL "flightRule":"VFR" "visibilityKM":11.26538 "visibilityMI":7 "weather":"Mostly Clear" "weatherShort":"Mostly Clear" "weatherCoded":"::FW" "weatherPrimary":"Mostly Clear" "weatherPrimaryCoded":"::FW" "cloudsCoded":"FW" "icon":"pcloudyn.png" "heatindexC":12.8 "heatindexF":55 "windchillC":12.8 "windchillF":55 "feelslikeC":12.8 "feelslikeF":55 "isDay":false "sunrise":1587013033 "sunriseISO":"2020-04-16T06:57:13+02:00" "sunset":1587062673 "sunsetISO":"2020-04-16T20:44:33+02:00" "snowDepthCM":NULL "snowDepthIN":NULL "precipMM":NULL "precipIN":NULL "solradWM2":0 "solradMethod":"estimated" "ceilingFT":NULL "ceilingM":NULL "light":0 "uvi":NULL "QC":"O" "QCcode":10 "trustFactor":100 "sky":19
To integrate the AerisWeather API into your application you can use the following code snippet, or generate your own on RapidAPI in your desired language:
var unirest = require("unirest"); var req = unirest("GET", "https://aerisweather1.p.rapidapi.com/observations/48.8566%252C2.3522"); req.headers({ "x-rapidapi-host": "aerisweather1.p.rapidapi.com", "x-rapidapi-key": "YOUR-API-KEY-HERE" }); req.end(function (res) { if (res.error) throw new Error(res.error); console.log(res.body); });
You will notice the required parameter for the AerisWeather API is slightly different than Dark Sky. Like Dark Sky, it supports using latitude and longitude as shown in the snippet above. You can also use ‘city,state’ or ‘city,country’ or ‘postal code’ instead. Keep this in mind, as you will now have more flexibility in how you input location data.
2: Fetching the 2 Day Hourly Forecast for a Specific Location
Let’s look at another example. The Dark Sky API provides a 2-day hourly forecast using the Forecast endpoint. The response has weather data for 48 hours, separated by the hour. To reproduce this in AerisWeather, you can use the Forecasts endpoint.
The only required parameter is location. To get the 2-day 48 hour format, you must also fill out a few optional parameters.
- plimit (limits the number of intervals returned in your forecast): 48
- filter (the forecast interval, can be 1h, 4h, mdnt2mdnt, etc): 1hr
By default, this setup will return the hourly data for the current day and the day after. If you would like to adjust the timeframe, you can set the from parameter to your desired date. The input is YYYY-MM-DD format.
Here is an example code snippet that returns a 2-day hourly forecast for San Francisco:
var unirest = require("unirest"); var req = unirest("GET", "https://aerisweather1.p.rapidapi.com/forecasts/sanfrancisco%252Cca"); req.query({ "plimit": "48", "filter": "1hr" }); req.headers({ "x-rapidapi-host": "aerisweather1.p.rapidapi.com", "x-rapidapi-key": "YOUR-API-KEY-HERE" }); req.end(function (res) { if (res.error) throw new Error(res.error); console.log(res.body); });
3: Obtaining Historical Data for a Specific Location
If you were using the Dark Sky endpoint Time Machine, you can transition to the AerisWeather endpoint Daily Summaries. The summaries are based on previously recorded data, and can go back as far as 2011.
Just like the previous examples, the only required parameter for the Daily Summaries endpoint is location. You can adjust the timeframe using the to or from parameters. Here as an example code snippet that retrieves the weather for San Francisco on January 1st, 2020:
var unirest = require("unirest"); var req = unirest("GET", "https://aerisweather1.p.rapidapi.com/observations/summary/san%2520francisco%252Cca"); req.query({ "from": "2020-01-01" }); req.headers({ "x-rapidapi-host": "aerisweather1.p.rapidapi.com", "x-rapidapi-key": "468fc60dbdmsh8cad2b8eb2a2e55p16f04bjsneb9f77416dc3" }); req.end(function (res) { if (res.error) throw new Error(res.error); console.log(res.body); });
Final Thoughts
Again, we highly encourage you to transition from the recently deprecated Dark Sky API to another weather API. One weather API we recommend as an alternative to Dark Sky is AerisWeather. We hope the examples above and the AerisWeather documentation can help you easily transition and update your application. Please let us know if you have any questions or need additional support.
Leave a Reply