{
  "openapi": "3.0.0",
  "info": {
    "title": "1 Minute Observations API",
    "version": "4.3.2"
  },
  "servers": [
    {
      "url": "https://api.metservice.com/observations/nz/1-minute"
    }
  ],
  "paths": {
    "/weatherStation": {
      "get": {
        "description": "Get Weather Station. This call will return a list of weather station, runway or road sensor identifiers and known metadata for which at least 1 observation has been received in the last 60 minutes.",
        "operationId": "getWeatherStation",
        "summary": "Get Weather Station",
        "tags": [
          "WEATHERSTATION"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "The list of station and sensor identifiers with any known metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/stationlist-json"
                },
                "example": {
                  "version": "1.0",
                  "request-time": "2021-10-05T23:00:43Z",
                  "path": "/observations/nz/1-minute/weatherStation",
                  "attributes": {
                    "dataset": "observation:1minuteobservation",
                    "provider": "metservice"
                  },
                  "results": [
                    {
                      "WMOID": 55077
                    },
                    {
                      "WMOID": 93004,
                      "ICAOID": "NZCRX",
                      "name": "Cape Reinga",
                      "latitude": -34.43,
                      "longitude": 172.682,
                      "elevation": 214
                    },
                    {
                      "WMOID": 93067,
                      "ICAOID": "NZMPX",
                      "name": "Marsden Point AWS",
                      "latitude": -35.839,
                      "longitude": 174.5,
                      "elevation": 20
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "429": {
            "$ref": "#/components/responses/429"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        }
      }
    },
    "/weatherStation/{stationId}/latest": {
      "get": {
        "description": "Get Weather Station Station Id Latest. Get the latest observation for a weather station or sensor.",
        "operationId": "getWeatherStationStationIdLatest",
        "summary": "Get Weather Station Station Id Latest",
        "tags": [
          "WEATHERSTATION"
        ],
        "parameters": [
          {
            "name": "format",
            "description": "The format that the returned json payload should be in.",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "json",
              "enum": [
                "json",
                "cf-json"
              ]
            }
          },
          {
            "name": "vars",
            "description": "A filter with a comma sepearated list of observed vairable names to return in the reposnse.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stationId",
            "description": "The numeric WMO or alpha-numeric ICAO identifier for this weather station or sensor.",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "minLength": 5,
              "maxLength": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The last received observed data for the specified station or sensor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/latest-json"
                },
                "examples": {
                  "Standard Response": {
                    "value": {
                      "version": "1.0",
                      "request-time": "2020-06-16T23:37:48Z",
                      "path": "/observations/nz/1-minute/weatherStation/93968/latest?format=json",
                      "attributes": {
                        "dataset": "observation:1minuteobservation",
                        "provider": "metservice",
                        "station": "93968",
                        "station-alpha": "NZWNK"
                      },
                      "results": [
                        {
                          "obs_timestamp": "2020-06-16T23:36:00Z",
                          "roadcdn_01mnavg": 10,
                          "road_t3_01mnavg": 14.1,
                          "roadfrt_01mnavg": 0.82,
                          "roadtxt_01mnavg": "Dry",
                          "earth02_01mnavg": 14.1,
                          "roadflm_01mnavg": 0.01,
                          "roadflm_10mnavg": 0.01,
                          "road_t3_10mnavg": 14
                        }
                      ]
                    }
                  },
                  "Filtered Response (?vars=...)": {
                    "value": {
                      "version": "1.0",
                      "request-time": "2021-10-06T18:45:23Z",
                      "path": "/observations/nz/1-minute/weatherStation/NZKTA/latest?vars=airtemp_01mnavg,windspd_01mnavg,rainfal_01mnacc",
                      "attributes": {
                        "dataset": "observation:1minuteobservation",
                        "provider": "metservice",
                        "station": "93014",
                        "station-alpha": "NZKTA"
                      },
                      "results": [
                        {
                          "obs_timestamp": "2021-10-06T18:43:00Z",
                          "rainfal_01mnacc": 0.2,
                          "windspd_01mnavg": 7,
                          "airtemp_01mnavg": 15.6
                        }
                      ]
                    }
                  }
                }
              },
              "application/vnd.metocean.cf+json": {
                "schema": {
                  "$ref": "#/components/schemas/latest-cf-json"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "429": {
            "$ref": "#/components/responses/429"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        }
      }
    },
    "/weatherStation/{stationId}/last/{minutes}/minutes": {
      "get": {
        "description": "Get Weather Station Station Id Last Minutes Minutes. Get the last n minutes of observation data for a weather station or sensor",
        "operationId": "getWeatherStationStationIdLastMinutesMinutes",
        "summary": "Get Weather Station Station Id Last Minutes Minutes",
        "tags": [
          "WEATHERSTATION"
        ],
        "parameters": [
          {
            "name": "format",
            "description": "The format that the returned json payload should be in.",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "json",
              "enum": [
                "json",
                "cf-json"
              ]
            }
          },
          {
            "name": "vars",
            "description": "A filter with a comma sepearated list of observed vairable names to return in the reposnse.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stationId",
            "description": "The numeric WMO or alpha-numeric ICAO identifier for this weather station or sensor.",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "minLength": 5,
              "maxLength": 5
            }
          },
          {
            "name": "minutes",
            "description": "The number of minutes of observations to return going back from the current time.",
            "required": true,
            "in": "path",
            "schema": {
              "type": "integer",
              "format": "int",
              "default": 1,
              "minimum": 1,
              "maximum": 1440
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The last n minutes of observed data for the specified weather station or sensor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/last-2-mins-json"
                },
                "example": {
                  "version": "1.0",
                  "request-time": "2020-06-16T23:37:48Z",
                  "path": "/observations/nz/1-minute/weatherStation/NZKTA/last/10/minutes",
                  "attributes": {
                    "dataset": "observation:1minuteobservation",
                    "provider": "metservice",
                    "station": "93014",
                    "station-alpha": "NZKTA"
                  },
                  "results": [
                    {
                      "obs_timestamp": "2020-06-16T23:28:00Z",
                      "windspd_01mnavg": 7,
                      "airtemp_01mnavg": 15.6
                    },
                    {
                      "obs_timestamp": "2020-06-16T23:29:00Z",
                      "windspd_01mnavg": 7,
                      "airtemp_01mnavg": 15.6
                    }
                  ]
                }
              },
              "application/vnd.metocean.cf+json": {
                "schema": {
                  "$ref": "#/components/schemas/last-4-mins-cf-json"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "429": {
            "$ref": "#/components/responses/429"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        }
      }
    },
    "/weatherStation/{stationId}/range/{fromDateTime}/{toDateTime}": {
      "get": {
        "description": "Get Weather Station Station Id Range From Date Time To Date Time. Get the observation data for a spedified date time range.",
        "operationId": "getWeatherStationStationIdRangeFromDateTimeToDateTime",
        "summary": "Get Weather Station Station Id Range From Date Time To Date Time",
        "tags": [
          "WEATHERSTATION"
        ],
        "parameters": [
          {
            "name": "format",
            "description": "The format that the returned json payload should be in.",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "json",
              "enum": [
                "json",
                "cf-json"
              ]
            }
          },
          {
            "name": "vars",
            "description": "A filter with a comma sepearated list of observed vairable names to return in the reposnse.",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stationId",
            "description": "The numeric WMO or alpha-numeric ICAO identifier for this weather station or sensor.",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "minLength": 5,
              "maxLength": 5
            }
          },
          {
            "name": "fromDateTime",
            "description": "The start date/time of the date/time range of observations being requested.",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "toDateTime",
            "description": "The end date/time of the date/time range of observations being requested.",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The observed data for the specified weather station or sensor for the given time range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/last-2-mins-json"
                },
                "example": {
                  "version": "1.0",
                  "request-time": "2020-06-19T04:48:00Z",
                  "path": "/observations/nz/1-minute/weatherStation/93110/range/2020-06-19T04:00:00Z/2020-06-19T04:48:00Z",
                  "attributes": {
                    "dataset": "observation:1minuteobservation",
                    "provider": "metservice",
                    "station": "93110",
                    "station-alpha": "NZKTA"
                  },
                  "results": [
                    {
                      "obs_timestamp": "2020-06-19T04:01:00Z",
                      "windspd_01mnavg": 7,
                      "airtemp_01mnavg": 15.6
                    },
                    {
                      "obs_timestamp": "2020-06-19T04:02:00Z",
                      "windspd_01mnavg": 8,
                      "airtemp_01mnavg": 15.7
                    }
                  ]
                }
              },
              "application/vnd.metocean.cf+json": {
                "schema": {
                  "$ref": "#/components/schemas/last-4-mins-cf-json"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "429": {
            "$ref": "#/components/responses/429"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "stationlist-json": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string"
          },
          "request-time": {
            "type": "string",
            "format": "date-time"
          },
          "path": {
            "type": "string"
          },
          "attributes": {
            "type": "object",
            "properties": {
              "dataset": {
                "type": "string"
              },
              "provider": {
                "type": "string"
              }
            }
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "WMOID": {
                  "type": "integer"
                },
                "ICAOID": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "latitude": {
                  "type": "number"
                },
                "longitude": {
                  "type": "number"
                },
                "elevation": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "latest-json": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string"
          },
          "request-time": {
            "type": "string",
            "format": "date-time"
          },
          "path": {
            "type": "string"
          },
          "attributes": {
            "type": "object"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        }
      },
      "latest-cf-json": {
        "type": "object",
        "properties": {
          "attributes": {
            "type": "object"
          },
          "dimensions": {
            "type": "object"
          },
          "variables": {
            "type": "object"
          }
        },
        "example": {
          "attributes": {
            "dataset": "observation:1minuteobservation",
            "provider": "metservice",
            "station": "93968",
            "station-alpha": "NZWNK"
          },
          "dimensions": {
            "time": 1
          },
          "variables": {
            "time": {
              "type": "string",
              "shape": [
                "time"
              ],
              "attributes": {
                "units": "ISO8601 timestamps",
                "calendar": null,
                "ordering": "descending",
                "long_name": "time"
              },
              "data": [
                "2020-06-16T23:35:00Z"
              ]
            },
            "road_t3_01mnavg": {
              "type": "float",
              "shape": [
                "time"
              ],
              "missing_value": null,
              "attributes": {
                "standard_name": "sensor_internal_temperature_average_over_1min",
                "long_name": "Sensor internal temperature ~2 cm averaged over 1 minute",
                "units": "degC",
                "description": "Sensor internal temperature ~2 cm averaged over 1 minute",
                "valid_min": -100,
                "valid_max": 100,
                "precision": 1
              },
              "data": [
                14.1
              ]
            },
            "roadflm_01mnavg": {
              "type": "float",
              "shape": [
                "time"
              ],
              "missing_value": null,
              "attributes": {
                "standard_name": "road_surface_water_film_height_average_over_1min",
                "long_name": "Road water film height averaged over 1 minute",
                "units": "mm",
                "description": "Road water film height averaged over 1 minute",
                "valid_min": 0,
                "valid_max": 500,
                "precision": 1
              },
              "data": [
                0.01
              ]
            }
          }
        }
      },
      "last-2-mins-json": {
        "$ref": "#/components/schemas/latest-json"
      },
      "last-4-mins-cf-json": {
        "$ref": "#/components/schemas/latest-cf-json"
      },
      "400-json": {
        "type": "object",
        "properties": {
          "Request-ID": {
            "type": "string"
          },
          "Status": {
            "type": "string"
          },
          "Summary": {
            "type": "string"
          },
          "Diagnosis": {
            "type": "string"
          },
          "Info": {
            "type": "string"
          }
        },
        "example": {
          "Request-ID": "00000170ea0d525b-2bd8c2",
          "Status": "HTTP Error 400",
          "Summary": "The requested URL cannot be processed",
          "Diagnosis": "Invalid value '939698' for uri parameter stationId. expected maxLength: 5, actual: 6",
          "Info": "Refer to the API documentation"
        }
      },
      "401-json": {
        "type": "object",
        "properties": {
          "Request ID": {
            "type": "string"
          },
          "Status": {
            "type": "string"
          },
          "Summary": {
            "type": "string"
          },
          "Diagnosis": {
            "type": "string"
          },
          "Info": {
            "type": "string"
          }
        },
        "example": {
          "Request ID": "00000172778b4a89-2b828",
          "Status": "HTTP Error 401",
          "Summary": "The requested URL cannot be processed",
          "Diagnosis": "Unauthorised",
          "Info": "Please refer to the API documentation for supported endpoints and usage"
        }
      },
      "500-json": {
        "type": "object",
        "properties": {
          "Request-ID": {
            "type": "string"
          },
          "Status": {
            "type": "string"
          },
          "Summary": {
            "type": "string"
          },
          "Diagnosis": {
            "type": "string"
          },
          "Info": {
            "type": "string"
          }
        },
        "example": {
          "Request-ID": "00000172778b4a89-2b829",
          "Status": "HTTP Error 500",
          "Summary": "Internal Server Error",
          "Diagnosis": "'until-successful' retries exhausted. Last exception message was: HTTP POST on resource 'http://non-exisent.com:80/observation-manifest/entry/_search' failed: Couldn't resolve address.",
          "Info": "Please contact the Metservice service desk quoting the request ID: 00000172778b4a89-2b829"
        }
      },
      "429-json": {
        "type": "object",
        "properties": {
          "Request-ID": {
            "type": "string"
          },
          "Status": {
            "type": "string"
          },
          "Summary": {
            "type": "string"
          },
          "Diagnosis": {
            "type": "string"
          },
          "Info": {
            "type": "string"
          }
        },
        "example": {
          "Request-ID": "00000172778b4a89-2b830",
          "Status": "HTTP Error 429",
          "Summary": "Too Many Requests",
          "Diagnosis": "You have either exceeded your daily quota of API requests or have exceeded the number of requests allowed per second based on your API Account Plan.",
          "Info": "Please review your API Account Plan."
        }
      },
      "404-json": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        },
        "example": {
          "message": "Not Found"
        }
      }
    },
    "responses": {
      "400": {
        "description": "Bad Request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/400-json"
            }
          }
        }
      },
      "401": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/401-json"
            }
          }
        }
      },
      "429": {
        "description": "Too Many Requests",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/429-json"
            }
          }
        }
      },
      "500": {
        "description": "Internal Server Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/500-json"
            }
          }
        }
      },
      "404": {
        "description": "Not Found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/404-json"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "Classic_API_Key": {
        "type": "apiKey",
        "in": "header",
        "name": "apikey",
        "description": "Standard API Key authentication.\nProvide it in the `apikey` header."
      }
    }
  },
  "security": [
    {
      "Classic_API_Key": []
    }
  ]
}