RapidAPI logo

Sunrise and Sunset

FREE
By mazon
Updated 4 months ago
Data
8.8/10
Popularity Score
504ms
Latency
98%
Success Rate

Sunrise and Sunset API Documentation

Get the sunrise and sunset information of a location by city, lat long or ip address.

View API Details
GETSunrise/set by Lat/Lon
GETSunrise/set by IP Address
GETSunrise/set by City
GETSunrise/set by Lat/Lon
Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
Optional Parameters
latitudeNUMBER
OPTIONAL
longitudeNUMBER
OPTIONAL
dateSTRING
OPTIONALIf a date other than today is wanted provide a valid date in the format above.
Code Snippet
unirest.get("https://sun.p.rapidapi.com/api/sun/?latitude=38.0000&longitude=-97.0000&date=2016-06-01")
.header("X-RapidAPI-Host", "sun.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
General
Request URL: https://sun.p.rapidapi.com/api/sun/
Request Method: GET
Response Headers
Response Body
Log inSign up

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.get("https://sun.p.rapidapi.com/api/sun/?latitude=38.0000&longitude=-97.0000&date=2016-06-01")
.header("X-RapidAPI-Host", "sun.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication