Sunrise & Sunset API
Powered by DTN

Overview


When the sun sets, the horizon's color turns into beautiful variations of yellow, orange and red.

DTN Sunrise & Sunset API offers concrete sunset and sunrise times, so you will be informed, when to look towards the horizon.

This is a service to compute the local sunrise and sunset at a given longitue/latitude and date combination.

The API uses the algorithm found at the Almanac for Computers, published by the Nautical Almanac Office of the United States Naval Observatory in Washington, D.C.

How is the request processed?


Once a properly-authenticated and formatted request is received, the application will query the Almanac.

The data is then processed and returned to you, formatted in the JSON format. This makes it easy to use in your business.

Formatting


A sample request using the Sunrise & Sunset API looks like this:

https://point-forecast.weather.mg/sunrise-sunset?locatedAt=13.2,52.4&validAt=2017-03-24

The above request will return the sunrise and sunset times for the city of Berlin, Germany on 24 March, 2017.


The returned data will be formatted in JSON, and will look like this:

   {
      "sunriseSunsetTime": [
        {
          "civilSunriseTime": "2017-03-24T05:27+01:00",
          "civilSunsetTime": "2017-03-24T19:01+01:00",
          "nauticalSunriseTime": "2017-03-24T04:47+01:00",
          "nauticalSunsetTime": "2017-03-24T19:42+01:00",
          "astronomicalSunriseTime": "2017-03-24T04:04+01:00",
          "astronomicalSunsetTime": "2017-03-24T20:24+01:00",
          "officialSunriseTime": "2017-03-24T06:02+01:00",
          "officialSunsetTime": "2017-03-24T18:27+01:00"
          "locatedAt": [
            13.2,
            52.4
          ],
          "validAt": "2017-03-24",
          "locationTimeZoneName": "Europe/Berlin",
        }
      ]
    }
    

Authentication


For detailed instructions on how to obtain the necessary authorization information, please refer to the technical documentation on Bitbucket.

Nitty-Gritty


For more detailed information on this API, check us out on Bitbucket.