JSON Output Format
The API produces data in the JSON format by default. Fortunately, JSON has native decoders in a large number of programming languages, so you only need to know the structure of the returned data to use it. Each API service outputs a different format of JSON depending on the needs of that service. This section explains the basic JSON structure, as well as a detailed explanation of the /stations service output formats.
JSON is an ideal protocol for exchanging data objects and structures, however it is not well-suited for large volumes of data. To decode a JSON object, data must be held entirely in memory.
Generic JSON structure
Result sets have 4 main elements: STATIONS
, UNITS
for the variables queried, the SUMMARY
and QC_SUMMARY
. A successful query will have a SUMMARY
like this (where RESULT
represents any number of data queries). All services except for the /auth
,/variables
and some errors use the same basic JSON structure, which is comprised of a single object. This object has various elements (keys), finishing with a SUMMARY
key. The SUMMARY
object details API performance and status for the query you made.
{
"RESULT": [...],
"SUMMARY": {
"NUMBER_OF_OBJECTS": 2,
"RESPONSE_CODE": 1,
"VERSION": "v2.21.0",
"RESPONSE_MESSAGE": "OK",
"RESPONSE_TIME": "4.48298454285 ms"
}
}
A query summary contains the following pieces of information (Services available in)
Parameter | Meaning |
---|---|
| How many discrete objects were returned, for \stations queries this is the number of individual stations returned, for \networks, how many networks, and for \networktypes, how many types. (All Services) |
| An internally-defined code for the state of a query. See the table in the Errors section for an explanation of possible values. (All Services) |
| A string representing the same message as the |
| The API’s current version number. (All Services) |
| The amount of time it took for the API to query and parse the metadata. (All Data Services) |
| The amount of time it took for the API to query the data from the database. (All Data Services) |
| The amount of time it took for the API to format the queried data into output (All Services except Metadata and Variables) |
| The amount of time if took for the API to query and parse the data. (All Services except Metadata, Precipitation and Variables) |
| The amount of time it took for the Advanced Precipitation server to query the raw precipitation data, process the data and parse the data. (Precipitation) |
| The amount of time if took for the API to query and parse the data. (Variables) |
| A diagnostic indicator for Synoptic’s developers .(Time Series, QC Segments) |
In the event of an error, the structure of the SUMMARY
object is discussed in the Errors section of the documentation.
Stations
Station metadata JSON structure.
With no data, station metadata are presented as a list of objects within an element named STATION
. Therefore the top two keys of the JSON are STATION
and SUMMARY
.
{
'STATION':[ ... ]
'SUMMARY': { ... }
}
Default station metadata values
Without complete metadata (&complete=1
), the default columns included for each station entry are as follows. These values are included for all stations retrieved for all queries.
Parameter | Meaning | Format |
---|---|---|
| Internal Synoptic identification number for the station. | string integer |
| Station name | string |
| Station abbreviation/Identifier | string |
| Numeric ID of the network | string integer |
| Elevation above mean sea level in feet | string float |
| Elevation produced by the Digital Elevation Model | string float |
| Units for elevation and sensor height (position). Observation units are within the | object |
| Longitude | string float |
| Latitude | string float |
| US or Canadian 2-letter state abbreviation | string |
| ISO-8601 compliant station timezone (approximate for offshore and Canadian stations) | string |
| String defining if the station is | string |
| List with the start and end of a station's record | |
|
| boolean |
Complete station metadata values
The following additional categories are returned for complete metadata requests (&complete=1
).
Parameter | Meaning | Format |
---|---|---|
| Network short name | string |
| 2-letter Country abbreviation | string |
| NWS Fire zone | string |
| County in which the station is located | string |
| NWS County Warning Area (Which NWS Forecast office covers the station location) | string |
| NWS Forecast zone | string |
| Geographic Area Coordination Center ID | string |
| Sub-Geographic Area Coordination Center ID | string |
| Weather Information Management System ID | string |
| Name and URL of the data provider (if available) | object |
Period of record objects
Various areas will indicate a “period of record” for a given platform, variable or other resource. This is always indicated with the key PERIOD_OF_RECORD
within the nested object response.
Period of record objects do not recognize timeformat
arguments, and the timestamp is always in ISO8601 format.
Parameter | Meaning | Format |
---|---|---|
| timestamp of the first observation received in the represented category | string (ISO8601 timestamp) |
| timestamp of the last observation received in the represented category. May be delayed by several days by infrequent processing | string (ISO8601 timestamp) |
Example json of a period of record
"PERIOD_OF_RECORD": {
"start": "1997-10-22T00:00:00Z",
"end": "2002-04-07T17:00:00Z"
}
Station data JSON Structure
In addition to the default metadata structure (or extended metadata if requested), data are inserted into the resultant JSON output within the station object outlined above. In addition to the STATION
and SUMMARY
elements of the JSON object, a new element is added called UNITS
. This object is a set of key-value pairs matching variable IDs to the units they are sent in. The unit strings match those in the data results set.
The station objects within the STATION
element have 2 additional elements added to them. Both are formatted as objects.
New Element | Purpose |
---|---|
| A list of names of the variables returned from this station. This summarizes the variables which will be found in the |
| The element which holds variable data and time stamps. |
So, this is the generic structure of a Station data query from the API:
{
UNITS: {},
STATION: [
{
STATUS: "ACTIVE",
MNET_ID: "153",
PERIOD_OF_RECORD: {
start: "1997-01-01T00:00:00Z",
end: "2023-07-21T17:30:00Z"
},
ELEVATION: "4806",
NAME: "U of U William Browning Building",
STID: "WBB",
SENSOR_VARIABLES: {},
ELEV_DEM: "4727.7",
LONGITUDE: "-111.84755",
UNITS: {
position: "m",
elevation: "ft"
},
STATE: "UT",
OBSERVATIONS: {},
RESTRICTED: false,
LATITUDE: "40.76623",
TIMEZONE: "America/Denver",
ID: "1"
}
],
SUMMARY: { ... }
}
The SENSOR_VARIABLES element
A list of names of the variables returned from this station. This summarizes the variables which will be found in the OBSERVATIONS
element. This section includes sensor specific metadata, which can be useful for stations with multiple sensors reporting the same variable.
This element is returned with the parameter sensorvars=1
. When not specified, Latest, Time Series, and Nearest will return empty objects within the SENSOR_VARIABLES
element.
New Element | Purpose | Format |
---|---|---|
| The height/depth of the sensor. (Units are given by | string float |
| The period of record for the given sensor. | |
| For derived variables only, the list of the sensors the variable is derived from. | object |
Example of SENSOR_VARIABLES
within the STATIONS
element:
STATION: [
{
SENSOR_VARIABLES: {
air_temp: {
air_temp_value_1: {
position: "2.0",
PERIOD_OF_RECORD: {
start: "1997-04-12T00:00:00Z",
end: "2023-07-21T21:40:00Z"
}
}
}
}
}
]
The OBSERVATIONS element
The last and trickiest part of the JSON response is the OBSERVATIONS
element. OBSERVATIONS
is an object/dictionary where the keys are variable names, and the values are lists. Variable names typically follow the format of var_value_n
, where n can be greater than 1 if a station has multiple sensors reporting the same variable (eg. air_temp_value_1
). This section will cover the OBSERVATIONS
element by services, with each header listing the relevant Weather API service.
The following parameters are common among all OBSERVATION
representations
Parameter | Meaning | Format |
---|---|---|
[variable identifier] | As discussed above, one or more keys for a variable, the variable index (VID) and the letter | varies |
| The time the observation indicated was reported | string |
| the value of the variable indicated | varies |
Latest, Nearest
In this case, each variable contains the date_time
the observation was recorded and the value
of the observation.
Example Latest output:
OBSERVATIONS: {
air_temp_value_1: {
date_time: "2023-07-21T11:55:00-0600",
value: 33.122
}
}
The time indicated by date_time
is the time the observation at value
was reported
The variable-date_time
relationship is much simpler for Time Series. In this case, all the elements within the OBSERVATIONS
element are lists of the same size, and the index of the variable observation is equivalent to the date_time
array. This will often result in null values for variables which only report periodically.
Example Time Series output:
OBSERVATIONS: {
date_time: [
"2023-07-20T00:00:00Z",
"2023-07-20T00:05:00Z",
"2023-07-20T00:10:00Z"
],
metar_set_1: [
"METAR KBUR 200000Z AUTO 17007KT 10SM CLR 33/11 A2994",
"METAR KBUR 200005Z AUTO 17008KT 10SM CLR 33/10 A2994",
"METAR KBUR 200010Z AUTO 17009KT 10SM CLR 33/09 A2994"
]
Precipitation
Advanced Precipitation processes raw precipitation data and returns derived precipitation totals or intervals for a requested time period and set of stations. The response JSON for precipitation requests varies based on the pmode
requested.
No mode requested
The default precip service functionality is a variant of totals
, but its response is distinct.
Parameter | Meaning | Format |
---|---|---|
| Precipitation in specified unit computed from precip variable | float |
| Date of first observation included in integration from precip variable | string |
| Date of last observation included in integration from precip variable | string |
| Number of observations included by precip variable | integer |
Example no-pmode response.
"OBSERVATIONS": {
"total_precip_value_1": 2.794,
"ob_start_time_1": "2023-01-01T00:00:00Z",
"ob_end_time_1": "2023-01-02T00:00:00Z",
"count_1": 1440
},
When pmode
is used
The following parameters are returned for Precipitation requests where pmode
is defined:
Parameter | Meaning | Format |
---|---|---|
| Total precipitation (Millimeters by default) | float |
| The total number of raw observations to derive the given precipitation total. | integer |
| Time of the first report (start of the | string |
| Time of the last report (end of the | string |
| Original recording frequency of the raw precipitation being processed. | string |
| Chronological position of an interval total for a | integer |
| The amount of hours totaled for a | integer |
Pmodes: totals
A distinct element in the precipitation
list is made per different type of precip measurement made by the station.
"OBSERVATIONS": {
"precipitation": [
{
"total": 2.794,
"first_report": "2023-01-01T00:00:00Z",
"last_report": "2023-01-02T00:00:00Z",
"count": 1440,
"report_type": "precip_accum_one_minute"
}
]
},
Pmodes: intervals
The precipitation
list is a collection of the amounts for the given intervals determined by your request. The same keys as totals
pmode
responses are used, with some additional.
"OBSERVATIONS": {
"precipitation": [
{
"total": 0.508,
"first_report": "2023-01-01T00:00:00Z",
"last_report": "2023-01-01T12:00:00Z",
"count": 720,
"interval": 1,
"report_type": "precip_accum_one_minute"
},
{
"total": 2.286,
"first_report": "2023-01-01T12:00:00Z",
"last_report": "2023-01-02T00:00:00Z",
"count": 720,
"interval": 2,
"report_type": "precip_accum_one_minute"
}
]
},
Pmodes: last
A list of objects by report type.
"OBSERVATIONS": {
"precipitation": [
{
"total": 8.636,
"first_report": "2022-12-31T00:00:00Z",
"last_report": "2023-01-02T00:00:00Z",
"count": 2876,
"accum_hours": 48,
"report_type": "precip_accum_one_minute"
}
]
},
Quality Control Segments
Quality Control Segments checks and returns the duration of associated QC flags for a requested period. The service returns a QC
element instead of OBSERVATIONS
.
QC: [
{
start: "2018-01-21T17:00:00Z",
qc_flag: 18,
sensor: "air_temp_qc_1",
end: "2018-01-21T17:00:00Z",
is_open: false
}
]
The following parameters are returned for Quality Control Segments requests:
Parameter | Meaning | Format |
---|---|---|
| Sensor name and number. | string |
| QC check ID (see QC Types). | integer |
| If the segment is open. If open, QC checks can continue past | boolean |
| Start time of the segment. | string |
| End time of segment. If the segment is open, the end time will be time of query. | string |
QC Summary JSON structure.
When qc=on
is requested (by default), the QC_SUMMARY
object will be returned. QC_SUMMARY
details API the QC check applied and number of violating observations in the following:
"QC_SUMMARY": {
"QC_CHECKS_APPLIED": [
"sl_range_check"
],
"TOTAL_OBSERVATIONS_FLAGGED": 0.0,
"PERCENT_OF_TOTAL_OBSERVATIONS_FLAGGED": 0.0,
"QC_NAMES": {
"1": "SynopticLabs Range Check"
},
"QC_SHORTNAMES": {
"1": "sl_range_check"
},
"QC_SOURCENAMES": {
"1": "SynopticLabs"
}
},
The QC_SUMMARY
contains the following parameters. All string
format:
Parameter | Meaning |
---|---|
| The list of QC check applied ( |
| The number of observations flagged. |
| The percent of observations flagged relative to the total observation requested. |
| Dictionaries mapping string QC type IDs from the |
Networks
Within the MNET object, the Networks service returns objects per Network containing station statistics and metadata. Example Networks output:
MNET: [
{
CATEGORY: "4",
REPORTING_STATIONS: 2457,
TOTAL_RESTRICTED: 0,
ACTIVE_RESTRICTED: 0,
LAST_OBSERVATION: "2023-08-02T00:00:00Z",
URL: null,
PERCENT_REPORTING: 94.14,
PERIOD_CHECKED: 120,
TOTAL_STATIONS: 3527,
ACTIVE_STATIONS: 2610,
PERIOD_OF_RECORD: {
start: "1997-01-01T00:00:00Z",
end: "2023-08-02T00:00:00Z"
},
LONGNAME: "ASOS/AWOS",
SHORTNAME: "ASOS/AWOS",
PERCENT_ACTIVE: 74,
ID: "1"
}
]
Each object within MNET
contains the following parameters:
Parameter | Meaning | Format |
---|---|---|
| Formal name of network. | string |
| Short name of network. | string |
| Network ID number (the same as | string integer |
| Network type, see Network Types service for details. | string integer |
| The interval of time used to calculate analytics. In minutes. | integer |
| Furthest extent of reporting history for the network. | |
| Number of stations currently reporting in this network. Interval is defined below. | integer |
| Total number of stations assigned to this network. | integer |
| Number of stations currently set to active status. | integer |
| Percentage of active stations currently reporting data. | float |
| Number of stations currently set to active status. | float |
| Time stamp of last observation seen. | string |
| Number of stations in the network whose data may be restricted for public distribution | float |
| Number of those restricted stations which are active. | float |
| Network/data provider’s URL, if available. | string |
Variables
Returns a list of all known variables (sensors) available within the Weather API. Example of the VARIABLES
object:
VARIABLES: [
{
air_temp: {
long_name: "Temperature",
unit: "Celsius",
vid: "3"
}
},
...
]
The objects within VARIABLE
contains the following parameters:
Parameter | Meaning | Format |
---|---|---|
| Formal name of sensor or variable. | string |
| Default unit of measure (metric). | string |
| Synoptic variable ID number. | string integer |
Network Types
Returns a list of all network categories available within the Weather API within the MNETCAT
object, example:
"MNETCAT": [
{
"DESCRIPTION": "Agricultural",
"ID": "1",
"NAME": "AG"
},
...
]
The objects within MNETCAT
contains the following parameters:
Parameter | Meaning | Format |
---|---|---|
| Short name of network type. | string |
| Description of network. | string |
| Network type ID. | string integer |
Quality Control Types
Returns a selection or list of the available data checks provided by both Synoptic Data and our third party providers within the QCTYPES
object, for example:
"QCTYPES": [
{
"SOURCE_ID": "1",
"SHORTNAME": "sl_range_check",
"ID": "1",
"NAME": "SynopticLabs Range Check"
}
]
The objects within QCTYPES
contains the following parameters:
Parameter | Meaning | Format |
---|---|---|
| Data check ID. This is the ID used in reporting data attributes. | string integer |
| Numerical representation of the source of the QC check | string integer |
| Formal name of data check. | string |
| Short name description of data check. | string |