GET /astronomy

DEPRECATED. This resource is deprecated. New use of this resource should be avoided. Existing use of this resource should be transitioned away from.

Description

Returns astronomical data by location, such as sunrise and sunset.

Requires a subscription plan with the “read_astronomy” capability to access this resource. This resource also has geospatial capabilities (such as “geo_north_america”) that must be available to the subscription plan for corresponding queries.

Resource URL

https://api.weathersource.com/v1/:api_key/astronomy.format

Resource URL Replacement Parts

{{api_key}}

Your API Key. If you do not have an API key, you may sign up for a free developer account 30-day trial.

{{format}}

The desired response format. Allowed formats are:

  • .json

Parameters


Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 108

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 110

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 108

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 110

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 108

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 110

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 108

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 110

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 108

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 110

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 108

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 110

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 108

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 110

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 108

Warning: Undefined array key "private" in /var/www/html/wp-content/themes/developer.weathersource.com/single-resource.php on line 110
latitude_eq required

A response condition that identifies the latitude portion of the latitude longitude location for the observation.

Allowed Values: decimal latitude value between 0 and 90

Example Value: 32.7153

longitude_eq required

A response condition that identifies the latitude portion of the latitude longitude location for the observation.

Allowed Values: decimal longitude value between -180 (West) and 180 (East)

Example Value: 117.1564

timestamp_eq optional

A response condition that returns a single element matching a timestamp. The returned timestamp may not equal the provided value, but will be representative of the value. For example, if the period parameter is set to hourly and the provided timestamp is for 8:15 a.m., the returned element will be for the 8 a.m. hour.

Either timestamp_eq or timestamp_between must be provided in ISO 8601 format.

TIP: Include the timezone offset portion of the timestamp for faster responses. (i.e. 2004-02-12T08:00+00:00 not 2004-02-12T08:00)

Allowed Values: ISO 8601 timestamp

Example Value: 2004-02-12T08:00+00:00 or 2004-02-12

timestamp_between optional

A response condition that returns the subset of elements with timestamps equal to or between those provided.

Either timestamp_eq or timestamp_between must be provided in ISO 8601 format.

TIP: Include the timezone offset portion of the timestamp for faster responses. (i.e. 2004-02-12T08:00+00:00 not 2004-02-12T08:00)

Allowed Values: Two comma separated ISO 8601 timestamps

Example Value: 2004-02-12T08:00,2004-02-12T23:00

period optional

Identifies astronomical data class.

Allowed Values: hour, day

Default Value: day

limit optional

DEPRECIATED. Specifies the quantity of elements to retrieve.

Allowed Values: Integers between 1 and 25

Default Value: 5

offset optional

DEPRECIATED. Specifies the first element to retrieve (index starts at 0).

Allowed Values: Integers greater than or equal to 0

Default Value: 0

fields optional

Set response to a subset of fields within each element. If the element contains a null value for a field, both the field name and the null value will be omitted from the response. Available field names:

The Hour class of astronomical data fields (period parameter is set to hour):

The Day class of astronomical data fields (period parameter is set to day):

Allowed Values: Comma separated list of field names

Default Value: latitude_and_longitude,timestamp

Resource Information

API Versions v1
Rate Limited? Yes
Requires Authentication? Yes
Response Formats JSON
JSONP
HTTP Method GET

Related Documentation

Example Request

GET https://api.weathersource.com/v1/{api_key}/astronomy.json?period=hour&latitude_eq=32.7153&longitude_eq=-117.1564&timestamp_eq=2013-02-10T06:00:00-08:00&fields=latitude,longitude,timestamp,sun_elevation,sun_azimuth,sun_distance,moon_elevation,moon_azimuth,moon_distance,moon_phase,moon_illumination,moon_age

[{"latitude":"32.7153","longitude":"-117.1564","timestamp":"2013-02-10T06:00:00-08:00","sun_elevation":-8.29,"sun_azimuth":101.79,"sun_distance":91745335,"moon_elevation":-2.86,"moon_azimuth":101.73,"moon_distance":233415,"moon_phase":"New Moon","moon_illumination":0.11,"moon_age":0.31}]