Latency
Returns transmission latency for a station or set of stations based on a start and end date/time.
Request Format
A Latency request is an HTTP URL with the following form:
https://api.synopticdata.com/v2/stations/latency
This service reports the delay time (in minutes) of an observation received at our ingest servers relative to the observation’s timestamp. Due to the nature of computer clock drift and time synchronization, some observations can be received “before they occur”. This results in a negative latency value. This can occur from in incorrect time stamp as provided by the station, or (more often than not) natural clock drift.
Acquiring data from this web service requires certain parameters. When encoding URLs, all parameters are separated using the ampersand (&) character and their value is indicated by an equal sign (=). Below is a list of accepted parameters.
token
(required), Your application’s API token. This is used to identify who is requesting API data. You are never required to use multiple tokens, but you can use as many as you need. Learn more in our tokens overview.Any number of station selection parameters (optional). Including no station selections will return results for all stations. This can result in extremely large results for services that support it.
start
andend
start
&end
, Defines the start and end time of the request with the form of YYYYmmddHHMM. Where YYYY is year, mm is month, dd is day, HH is hour, and MM is minutes. The start parameter must be used with the end parameter. For example:start=201306011800&end=201306021215
.All times are requested in UTC, but may be returned in either UTC or Local time format for each station. See the
obtimezone
parameter.
Optional Parameters
obtimezone
(UTC [default], local), Indicates if the time zone of the response is in UTC or the local timezone of the station where the data was observed. Sets the timezone applied to the observation output (input times associated withstart
andend
are always UTC). Example:obtimezone=local
showemptystations
(0 [default], 1), Indicates if stations with no observations for the requested time span will be returned. Indicates if stations with no observations will be returned. Setting to1
will return any station meeting the defined time period, variables, and geographic or network parameters, even if there are no observation data available.stats
(min, max, mean, median, count, stdev, all), Indicates what statistical values to return. Values can not be combined.stats=min
returns the minimum value and time stamp.stats=max
returns the maximum value and time stamp.stats=mean
returns the mean (average) value and start and end time stamps.stats=median
returns the median value and start and end time stamps.stats=count
returns the number of mins in time span.stats=stdev
returns the standard deviation value and start and end time stamps.stats=all
returns all statistics.
The following example returns the latency and statistics for stid=wbb
in for January 1, 2018:
https://api.synopticdata.com/v2/stations/latency?stid=wbb&start=201801010000&end=201801012359&stats=all&token=YOUR_TOKEN_HERE
Response Format Parameters
timeformat
, Defines a time format that all time stamps in the data response to be formatted to. By default the API will return time values in ISO 8601 format. This behavior can be changed by passing a string with a valid strftime expression. Below are some common examples.timeformat=%m/%d/%Y at %H:%M
would yield “06/22/2017 at 17:06”timeformat=%b%20%d%20%Y%20-%20%H:%M
would yield “Jun 22 2017 - 17:06”timeformat=%s
returns Unix/POSIX time in terms of seconds (this parameter cannot be used withobtimezone
). This is a special function in addition to the supported strftime arguments.
output
(json [default], xml), Indicates the response format of the request. It’s recommended to use the JSON format which there are well supported parsing libraries in all major languages.
Request Response
JSON Format
The Latency service will return its results in a single organized and self describing JSON object. At a minimum, every request will return a JSON object with a "SUMMARY"
field.
An example JSON response would be:
{
STATION: [
{
STATUS: "ACTIVE",
MNET_ID: "153",
PERIOD_OF_RECORD: {
start: "1997-01-01T00:00:00Z",
end: "2023-07-31T17:55:00Z"
},
ELEVATION: "4806",
NAME: "U of U William Browning Building",
LATENCY: {
date_time: ["2018-01-01T00:00:00Z","2018-01-01T00:01:00Z",...],
values: [-3,5,...]
},
RESTRICTED_DATA: "0",
STID: "WBB",
LONGITUDE: "-111.84755",
UNITS: {
position: "m",
elevation: "ft"
},
STATE: "UT",
STATISTICS: {
count: 1440,
start: "201801010000",
minimum: -3,
end: "201801012359",
mintime: "2018-01-01T00:00:00Z",
standard_deviation: 2.766415596008301,
maxtime: "2018-01-01T00:01:00Z",
median: 3,
average: 2.2166666984558105,
maximum: 5
},
LATITUDE: "40.76623",
TIMEZONE: "America/Denver",
ID: "1"
}
],
SUMMARY: {
DATA_QUERY_TIME: "116.713047028 ms",
RESPONSE_CODE: 1,
RESPONSE_MESSAGE: "OK",
METADATA_RESPONSE_TIME: "17.0068740845 ms",
DATA_PARSING_TIME: "5.17821311951 ms",
VERSION: "v2.21.0",
TOTAL_DATA_TIME: "121.893167496 ms",
NUMBER_OF_OBJECTS: 1
}
}
SUMMARY{}
NUMBER_OF_OBJECTS
, (always returned) is a integer value of the number of stations returned.RESPONSE_CODE
, (always returned) is a numerical code indicating the status of the request.“1” = “OK”
“2” = “Zero Results”
“200” = “Authentication failure”
“400” = “Violates a rule of the API”
RESPONSE_MESSAGE
, (always returned) is a string explaining theRESPONSE_CODE
.RESPONSE_TIME
, (always returned) server time to process the request.
STATION{}
LATENCY[]
, contains a timestamps and latency values in (in minutes)STATISTICS[]
, contains statistics.