Endpoint: observations/recent

The observations/recent endpoint provides access to recent observations for official observation stations, up to the past 30 days depending on API service level. Since this endpoint provides recent observations, all observations will be returned descending by observation date starting with the most recent.

Heads Up! This endpoint currently supports official observations stations only. Personal weather stations are not currently supported.

Supported Actions

The following actions are supported with the observations/recent endpoint:

closest The closest action will query the API for data that is closest to the requested place and return the results, if any, in order from closest to farthest. If no limit is provided in the request, then only the closest single result will be returned.

If your request does not return results, you may try setting or increasing the radius being used.
within The within action allows for returning data within a variety of different geometrical regions. Currently supported geometries include a circle (requires a center point and radius), rectangle (requires two coordinate points defining the top-left and bottom-right corners) and polygon (requires at least three coordinate points). Unlike the closest action, the results will not be returned in any particular order based on distance.
search The search action is used as a more general query method and expects the query to be defined with the custom query for the request. Unlike the closest action, results will not be returned in any particular order.

Supported Parameters

The following parameters are optional unless otherwise noted:

p p=:place Defines the location to query data for. Refer to the list of supported place value formats.
limit limit=:total The total number of results to return as an integer. Each endpoint may have a set maximum for this value depending on usage.

The default limit is 1 if not specified. The maximum limit for this endpoint is 250.
radius radius=:distance:unit When requesting the closest results within a circle, the radius determines how far from the specified location to search. A valid unit value must be included in your radius value, e.g., "5mi", "10km", "25miles". If no unit is provided, your value is assumed to be in meters by default.

Most endpoints utilize a default radius of 50 miles, though some endpoints, such as lightning, may have tighter restrictions specified.
filter filter=:string Predefined filters for limiting the results. The filter value can be a single, comma-delimited or a semicolon delimited string of filter names.
query query=:string Used to filter results based on certain fields in the data set. See Advanced Queries for more details.
sort sort=:string Used to sort results based on certain fields in the data set. See Sorting for more details.
skip skip=:number Used to skip over a specific number of results in the data set.
from from=:string Returns the results starting from the value specified. For best practices we recommend using the to parameter as well to define a specific time frame.

Supports a UNIX timestamp or a specific date string. Alternatively, common date formats supported by the PHP strtotime() function will be accepted; however, commas are not accepted.

Examples:
from=tomorrow
from=friday
from=1302883980
from=MM/DD/YYYY
from=YYYY/MM/DD
from=+2hours
from=2017-02-27 5:00 PM

to to=:string Returns the results between now and the value specified. For best practices we recommend using the from parameter as well to define a specific time frame. When used in conjunction with the from parameter, the value of to will be relative to the value of from, not relative to the current time.

Supports a UNIX timestamp or a specific date string. Alternatively, common date formats supported by the PHP strtotime() function will be accepted; however, commas are not accepted.

Examples:
to=+6hours
to=+5days
to=1302883980
to=MM/DD/YYYY
to=YYYY/MM/DD
to=2017-02-27 5:00 PM

plimit plimit=:total Applied only on the periods property, the total number of periods to return as an integer. The maximum plimit for this endpoint is 250.
psort psort=:string Applied only on the periods property, used to sort results based on certain fields contained within the periods.
pskip pskip=:number Applied only on the periods property, used to skip over a specific number of periods in the data set.
callback callback=:functionName Used with JSONP implementation.

Defines the callback function to use for the response. The response will be enclosed as C(response), where C is the callback function provided.
fields fields=:string Provides a comma separated list of values for the API to return. This parameter is often used to limit the amount of data returned. See Reducing Output.

Supported Filters

The following filters can be passed to the filter parameter to reduce the results that are returned:

hasprecip Returns observations that have a recorded precipitation.

Supported Query Properties

Use the following supported property keys when creating custom queries for your requests:

id Used to query the observation station's ID. Similar to passing the stations ID as the :id, but can be used to pull multiple stations at once.

Example:
/observations/search?query=id:KMSP,id:KROA&limit=2 (returns the latest observations for both KMSP and KROA)
temp Used to query the temperature. Values are in Celsius.
dewpt Used to query the dew point. Values are in Celsius.
rh Used to query the relative humidity.
pressure Used to query the barometric pressure. Values are in millibars.
wind Used to query the wind speed. Values are in knots.
winddir Used to query the wind direction in degrees. 0 being North.
gust Used to query wind gust speed. Values are in knots.
name Used to query the observation location's name.
state Used to query the observation station's state.

Example:
/observations/search?query=state:mn&sort=temp:-1 (Returns the observation for the location with the warmest temperature in Minnesota)
country Used to query the observation station's country.

Example:
/observations/search?query=country:us&sort=temp:-1 (returns the observation for the location with the warmest temperature in the US)
precip Query against the total precipitation in millimeters (liquid equivalent).
dt Used to query the observation based on date.
elev Used to query the observation based on elevation.
hasprecip Used to query for observations containing precipitation.

Sortable Fields

You can use the following fields to sort data. Review the sorting docs page for more information on the sort functionality.

id Sort based on the observation station's ID alphabetically.
name Sort based on the observation station's name.
state Sort based on the observation station's state.
country Sort based on the observation station's country.
dt (psort only) Sorts the period records based on the date/time of the observation. This is the default sort field, set to descending.

Example:
/observations/recent/KMSP?from=-4hours&plimit=4&sort:dt (returns up to 4 latest observations for station KMSP, ascending)
temp (psort only) Sorts the period records based on temperature.
dewpt (psort only) Sorts the period records based on dew point.
rh (psort only) Sorts the period records based on relative humidity.
pressure (psort only) Sorts the period records based on pressure.
wind (psort only) Sorts the period records based on wind.
winddir (psort only) Sorts the period records based on wind direction in degrees. 0 being North.
gust (psort only) Sorts the period records based on wind gusts.

Examples

The /[:endpoint]/[:action]? portion within the query template below can be exchanged with any of the examples. Also, please note you will need to input your client credentials in the [ID] and [SECRET] fields which can be found under the Apps section of the members area.

https://api.aerisapi.com/[:endpoint]/[:action]?client_id=[ID]&client_secret=[SECRET]

Returns the latest observation for ICAO KMSP.
/observations/recent/KMSP

Returns up to 4 latest observations during the past 4 hours, sorted by observation time descending.
/observations/recent/KMSP?from=-4hours&plimit=4

Returns the latest observation for the 5 closest observation stations to zip code 55403.
/observations/recent/closest?p=55403&limit=5

Returns up to 10 observations from the past 6 hours for the two closest observation stations to zip code 55403.
/observations/recent/closest?p=55403&limit=2&from=6hours&plimit=10

Returns the observations for the closest observation station to zip code 55403 that occurred on May 10, 2012.
/observations/recent/closest?p=55403&from=2012-05-10&to=2012-05-11&plimit=50

Returns up to 5 closest stations to zip code 55403, which had winds of 21.7 knots (25 mph), sometime over the past 3 days. Also returns up to 10 observations for each station, where the winds were 25mph or greater.
/observations/recent/closest?p=55403&query=wind:21.7&from=-3days&plimit=10&limit=5

Returns up to 10 observations from the past 6 hours for stations within the rectangle specified by the coordinates specified in the loc. The points should be top latitude, left longitude, bottom latitude, right longitude. Note the default max limit is 5, so a max of 5 locations will be returned.
/observations/within?p=45.25,-95.25,35.25,-85.25&from=-6hours&plimit=10

Returns 5 observations for Seattle starting from 8:00am on May, 22, 2012. Note that the default descending psort is overridden to return the periods in ascending instead.
/observations/seattle,wa?from=2012-05-22%2008:00:00&plimit=5&psort=dt

Response

The following is an example of what each object in the response will consist of. Depending on your requested action, the response may contain multiple instances of this object within an array.


{
    "id": "KMSP",
    "loc": {
        "long": -93.233333333333,
        "lat": 44.883333333333
    },
    "place": {
        "name": "minneapolis-st paul international",
        "state": "mn",
        "country": "us"
    },
    "periods": [
        {
            "ob": {
                "timestamp": 1336744380,
                "dateTimeISO": "2012-05-11T08:53:00-05:00",
                "tempC": 19,
                "tempF": 66,
                "dewpointC": 11,
                "dewpointF": 52,
                "humidity": 60,
                "spressureMB": 984,
                "spressureIN": 29.06,
                "altimeterMB": 1016,
                "altimeterIN": 30,
                "windKTS": 14,
                "windKPH": 26,
                "windMPH": 16,
                "snowDepthCM": null,
                "snowDepthIN": null,
                "precipMM": 0,
                "precipIN": 0,
                "solradWM2": null,
                "light": 68,
                "sky": 81,
                "pressureMB": 1011,
                "pressureIN": 29.85,
                "windSpeedKTS": 7,
                "windSpeedKPH": 13,
                "windSpeedMPH": 8,
                "windDirDEG": 240,
                "windDir": "WSW",
                "windGustKTS": null,
                "windGustKPH": null,
                "windGustMPH": null,
                "flightRule": "LIFR",
                "visibilityKM": 16.09344,
                "visibilityMI": 10,
                "weather": "Mostly Cloudy",
                "weatherShort": "Mostly Cloudy",
                "weatherCoded": "::BK",
                "weatherPrimary": "Mostly Cloudy",
                "weatherPrimaryCoded": "::BK",
                "cloudsCoded": "BK",
                "icon": "mcloudy.png",
                "heatindexC": 19,
                "heatindexF": 66,
                "windchillC": 19,
                "windchillF": 66,
                "feelslikeC": 19,
                "feelslikeF": 66,
                "isDay": true,
                "sunrise": 1336715566,
                "sunriseISO": "2012-05-11T00:52:46-05:00",
                "sunset": 1336759194,
                "sunsetISO": "2012-05-11T12:59:54-05:00"
            },
            "raw": "KMSP 111353Z 24007KT 10SM FEW150 BKN300 19/11 A2986"
        }
    ],
    "profile": {
        "tz": "America/Chicago"
        "elevM": 265,
        "elevFT": 869
    }
}
								

Response Properties

The following properties will be provided in every response object:

id (string) The reporting station ID.
periods (array) An array of observation objects.
periods[#].ob (object) The observation object
periods[#].ob.type (string) The type of observation, will be one of the following:
station - actual station observations
interpolated - interpolated / estimated observation
periods[#].ob.timestamp (number) UNIX timestamp of the observation.
periods[#].ob.dateTimeISO (string) ISO 8601 date of the observation.
periods[#].ob.recTimestamp (number) Unix timestamp of when the observation was received.
periods[#].ob.recDateTimeISO (string) ISO 8601 date of when the observation was received.
periods[#].ob.tempC (number) Temperature in Celsius. Null if not available.
periods[#].ob.tempF (number) Temperature in Fahrenheit. Null if not available.
periods[#].ob.dewpointC (number) Dew point temperature in Celsius. Null if not available.
periods[#].ob.dewpointF (number) Dew point temperature in Fahrenheit. Null if not available.
periods[#].ob.humidity (number) Relative humidity. Null if not available.
periods[#].ob.pressureMB (number) Mean Sea Level Pressure (MSLP) in millibars. Null if not available. This is the pressure reading most commonly used by meteorologists to track weather systems at the surface.
periods[#].ob.pressureIN (number) Mean Sea Level Pressure (MSLP) in inches of mercury. Null if not available. This is the pressure reading most commonly used by meteorologists to track weather systems at the surface.
periods[#].ob.spressureMB (number) Station pressure in millibars. The pressure Null if not available. This is the pressure that is observed at a specific elevation and is the true barometric pressure of a location.
periods[#].ob.spressureIN (number) Station pressure in inches of mercury. Null if not available. This is the pressure that is observed at a specific elevation and is the true barometric pressure of a location.
periods[#].ob.altimeterMB (number) Altimeter in millibars. Null if not available.
periods[#].ob.altimeterIN (number) Altimeter in inches of mercury. Null if not available.
periods[#].ob.windSpeedKTS (number) Wind speed in knots. Null if not available.
periods[#].ob.windSpeedKPH (number) Wind speed in kilometers her hour. Null if not available.
periods[#].ob.windSpeedMPH (number) Wind speed in miles per hour. Null if not available.
periods[#].ob.windDirDEG (number) Wind direction in degrees. Null if not available.
periods[#].ob.windDir (string) Wind direction in cardinal coordinates. Null if not available.
periods[#].ob.windGustKTS (number) Wind gust speed in knots. Null if no wind gusts or not available.
periods[#].ob.windGustKPH (number) Wind gust speed in kilometers her hour. Null if no wind gusts or not available.
periods[#].ob.windGustMPH (number) Wind gust speed in miles per hour. Null if no wind gusts or if not available.
periods[#].ob.flightRule (string) Flight rule indicator, based on weather conditions only. Potential values are: "LIFR", "IFR", "MVFR", "VFR". Null if not available.
periods[#].ob.visibilityKM (number) Visibility in kilometers. Null if not available.
periods[#].ob.visibilityMI (number) Visibility in miles. Null if not available.
periods[#].ob.weather (string) A string of the weather often including cloud coverage along with any prominent weather.
periods[#].ob.weatherShort (string) A shortened weather string.
periods[#].ob.weatherCoded (string) The coded weather. See the Coded Weather documentation for code options.
periods[#].ob.weatherPrimary (string) A string of the primary weather.
periods[#].ob.weatherPrimaryCoded (string) The primary coded weather. See the Coded Weather documentation for code options.
periods[#].ob.cloudsCoded (string) The coded cloud coverage. See the Coded Weather documentation for code options.
periods[#].ob.sky (number) Estimated percentage of sky coverage. 0 = clear, 100 = overcast. Null if not available.
periods[#].ob.ceilingFT (number) The cloud ceiling in feet, if available and reported. Null if not available or reported.
periods[#].ob.ceilingM (number) The cloud ceiling in meters, if available and reported. Null if not available or reported.
periods[#].ob.icon (string) Weather icon representing the observed weather from the default AerisWeather icon set. For more custom implementations, icons can be determined by the weatherCoded and weatherPrimaryCoded properties.
periods[#].ob.heatindexF (number) Heat index temperature in Fahrenheit. Null if not available.
periods[#].ob.heatindexC (number) Heat index temperature in Celsius. Null if not available.
periods[#].ob.windchillF (number) Wind chill temperature in Fahrenheit. Null if not available.
periods[#].ob.windchillC (number) Wind chill temperature in Celsius. Null if not available.
periods[#].ob.feelslikeF (number) Apparent temperature in Fahrenheit. Null if not available.
periods[#].ob.feelslikeC (number) Apparent temperature in Celsius. Null if not available.
periods[#].ob.isDay (boolean) Signifies if the observation occurred during daily hours. True if between sunrise and sunset, false otherwise.
periods[#].ob.sunrise (number) Timestamp of sunrise for the observation location. NOTE: If no sunrise (Midnight sun / polar night) a boolean false will be returned
periods[#].ob.sunriseISO (string) ISO 8601 date of the sunrise for the observation location. NOTE: If no sunrise (Midnight sun / polar night) a boolean false will be returned
periods[#].ob.sunset (number) Timestamp of sunset for the observation location. NOTE: If no sunset (Midnight sun / polar night) a boolean false will be returned
periods[#].ob.sunsetISO (string) ISO 8601 date of the sunset for the observation location. NOTE: If no sunset (Midnight sun / polar night) a boolean false will be returned
periods[#].ob.snowDepthCM (number) The estimated snow depth in centimeters at the observation location. Null if not available.
periods[#].ob.snowDepthIN (number) The estimated snow depth in inches at the observation location. Null if not available.
periods[#].ob.precipMM (number) The precipitation, in millimeters, as provided by the station. Null if not available. NOTE: Some stations may report this value differently. For example:
-Precip since the top of the hour
-Running 60-minute precip. i.e. 1.2” reported at 3:23 pm would be the value from 2:23 pm to 3:23 pm
-Precip since last observation.

If attempting to calculate the daily precip amount we recommend using the Observation Summary endpoint.
periods[#].ob.precipIN (number) The precipitation, in inches, as provided by the station. Null if not available. NOTE: Some stations may report this value differently. For example:
-Precip since the top of the hour
-Running 60-minute precip. i.e. 1.2” reported at 3:23 pm would be the value from 2:23 pm to 3:23 pm
-Precip since last observation.

If attempting to calculate the daily precip amount we recommend using the Observation Summary endpoint.
periods[#].ob.solradWM2 (number) The solar radiation as observed from station or estimated if not available from station
periods[#].ob.solradMethod (string) observed = reported by station
estimated = calculated since not reported by station
periods[#].ob.light (number) The estimated light rate as a percentage based on solradWM2 when available, otherwise calculated. Null if not available.
periods[#].ob.QCcode (number) Quality Control Code is the numerical version of QC (quality control):
0 = failed QC
1 = caution (some observation attributes may be invalid)
3 = probation (a station will be on probation if it's new, changed location, or having significant data issues)
7 = Questioned. While the observation passes QC, some elements may be out of characteristic for the station
10 = OK, passed QC
periods[#].ob.trustFactor (number) The trust factor of the observation. This value combines both the individual observation QC value and the overall confidence in the station.
Will be a value from 0 -100 and is equivalent to the QCcode * Station Confidence.

Note: New stations will start with a lower confidence. Additionally, stations that have observations that fail QC may have their station confidence lowered.
By default the API requires a trustFactor of 80 or above.
periods[#].raw (string) Raw observation data if available. (i.e. raw metar or synops). Null if not available.
periods[#].profile.elevM (number) The elevation of the location in meters.
periods[#].profile.elevFT (number) The elevation of the location in feet.
periods[#].profile.tzname (string) The time zone name abbreviation, if one. Such as EST, EDT etc.
periods[#].profile.tzoffset (number) The time zone offset in seconds from UTC time.
periods[#].profile.isDST (boolean) True is the location is in Daylight Savings Time, at the time of the observation.
loc.long (number) The longitude coordinate of the record.
loc.lat (number) The latitude coordinate of the record.
place.name (string) The place or nearest place to the record.
place.state (string) The state abbreviation in which the record is located. This may be null depending on the country.
place.country (string) The country abbreviation in which the record is located.
profile.tz (string) The timezone name association with the record's location.
relativeTo.lat (number) Latitude coordinate of the location used for the request. This may be different than the record's loc.lat value if there was no record exactly at the request location.
relativeTo.long (number) Longitude coordinate of the location used for the request. This may be different than the record's loc.long value if there was no record exactly at the request location.
relativeTo.bearing (number) Bearing in degrees of the record's location relative to the location used for the request.
relativeTo.bearingEng (string) Cardinal direction of the record relative to the location used for the request.
relativeTo.distanceKM (number) Distance, in kilometers, from the requested location to the record's actual location.
relativeTo.distanceMI (number) Distance, in miles, from the requested location to the record's actual location.
profile.elevM (number) The elevation of the location in meters.
profile.elevFT (number) The elevation of the location in feet.

Last modified: August 01, 2017