sondehub-infra/swagger.yaml
2021-04-10 15:06:44 +10:00

511 lines
16 KiB
YAML

swagger: "2.0"
info:
description: "SondeHub v2 API"
version: "2.0.0"
title: "SondeHub"
termsOfService: "http://github.com/projecthorus/sondehub-infra"
contact:
email: "vk3fur@sondehub.org"
license:
name: "Creative Commons BY-SA 2.0"
url: "https://creativecommons.org/licenses/by-sa/2.0/"
host: "api.v2.sondehub.org"
basePath: "/"
schemes:
- "https"
paths:
/sondes/telemetry:
put:
summary: Upload Radiosonde Telemetry to Sondehub database.
consumes:
- "application/json"
produces:
- "text/plain"
parameters:
- in: header
name: Date
description: <day-name>, <day> <month> <year> <hour>:<minute>:<second> UTC as per RFC7231. This is used to calculate receiver time offset for correcting clients that have the incorrect time.
required: true
type: string
format: date-time
- in: header
name: User-Agent
type: string
description: "The software and version performing the telemetry upload, eg: `autorx-1.4.1-beta5`"
- $ref: "#/parameters/input_payloads"
responses:
200:
description: Telemetry Saved into Database Successfuly
500:
description: Other Server error (including malformed data submissions)
get:
summary: Request Radiosonde Telemetry Data
description: >
Use this to get the current state of all the radiosondes then use the realtime API to access streaming data. Do not regularly poll this endpoint, it is rate limited.
produces:
- "application/json"
parameters:
- in: query
name: duration
description: How far back in time to receive data from. A shorter time period will result is higher time resolution data.
required: false
type: string
enum:
- "3h"
- "6h"
- "1d"
- "3d"
- in: query
name: serial
description: Specific serial number to query (if wanted). Requests for data for a single sonde will return the highest time resolution data available.
required: false
type: string
- in: query
name: datetime
description: "End time to query as an ISO-8601 time string. Defaults to now. Example: `2021-02-02T11:27:38.634Z`"
required: false
type: string
format: date-time
responses:
200:
description: Returns a dictionary keyed by serial number of a dictionary of times with SondeHub Telemetry values
schema:
$ref: "#/definitions/sonde_query_results_format"
/sondes:
get:
summary: Request latest sonde data indexed by serial number, with options for position/distance based-filtering.
produces:
- "application/json"
parameters:
- in: query
name: lat
type: number
description: "Latitude - if specified, lon and distance are required. Eg: -34.9285"
- in: query
name: lon
description: "Longitude - if specified, lat and distance are required Eg: 138.6007"
type: number
- in: query
name: distance
description: "Distance in meters - if specified, lat and lon are required"
type: number
- in: query
name: last
description: "How far back to search in seconds. Defaults to 24hrs"
type: number
responses:
200:
description: Returns a dictionary keyed by serial number of a dictionary of times with SondeHub Telemetry values
schema:
$ref: "#/definitions/sonde_query_results_format"
/sonde/{serial}:
get:
summary: Request telemetry data for an individual radiosonde
description: >
Use this to request all available telemetry data for an individual radiosonde, specified by serial number.
produces:
- "application/json"
parameters:
- in: path
name: serial
description: Serial number of the radiosonde to request data for. e.g. S1130567
required: true
type: string
responses:
200:
description: Returns a time-sorted array of SondeHub Telemetry objects. If no data for the requested serial number is available, the array will be empty.
schema:
type: array
items:
$ref: "#/definitions/telemetry_format"
/listeners:
get:
deprecated: true
summary: Requests a list of stations that have reported to Sondehub in the last 3 days. Used as a legacy endpoint for tracker.sondehub.org
produces:
- "application/json"
responses:
200:
description: List of stations receiving radiosonde data
schema:
type: array
description: Returns an array of objects containing listener data.
items:
type: object
properties:
name:
type: string
description: Callsign of the station.
tdiff_hours:
type: number
description: Number of hours since the station was last heard from.
lon:
type: number
format: double
description: Longitude of the station
lat:
type: number
format: double
description: Latitude of the station
alt:
type: number
description: Altitude of the station, in metres ASL.
description:
description: Text Description of the station, with HTML formatting.
type: string
put:
summary: 'Allows a station to upload their station information to the SondeHub database, for display on the SondeHub Tracker map. This endpoint can also be used to upload chase-car positions by setting the "mobile" setting to True'
consumes:
- "application/json"
produces:
- "text/plain"
parameters:
- in: body
required: true
name: body
schema:
$ref: "#/definitions/listener"
responses:
200:
description: Station Position successfully uploaded.
/sondes/websocket:
get:
description: Gets a presigned URL for use in connecting to the MQTT websocket endpoint.
produces:
- "text/plain"
responses:
200:
description: A presigned URL for connecting to the websocket MQTT feed.
/predictions:
get:
deprecated: true
description: Radiosonde landing predictions
produces:
- "application/json"
parameters:
- in: query
name: vehicles
type: string
description: If provided, filters predictions to a single provided serial number. Should be provided, but left blank if no filtering is required.
responses:
200:
description: Prediction results
schema:
$ref: "#/definitions/predictions"
/datanew:
get:
deprecated: true
description: "Legacy endpoint required by the sondehub tracker."
parameters:
- in: query
name: type
type: string
enum:
- positions
required: true
- in: query
name: max_positions
type: number
- in: query
name: mode
type: string
description: Duration to query
enum:
- "3days"
- "1day"
- "12hours"
- "6hours"
- "3hours"
- "1hour"
- in: query
name: chase_only
type: string
description: Return only chase cars
enum:
- "true"
- "false"
- in: query
name: vehicles
type: string
description: "Filter by serial. Currently only supports either none, or a single serial number"
- in: query
name: position_id
type: string
format: date-time
responses:
200:
description: Results compatible with sondehub mobile-tracker.
schema:
type: object
properties:
positions:
type: object
properties:
position:
type: array
items:
type: object
parameters:
input_payloads:
in: body
required: true
name: body
schema:
description: SondeHub telemetry format
items:
$ref: "#/definitions/telemetry_format"
definitions:
sonde_query_results_format:
type: object
properties:
serial:
type: object
properties:
datetime:
$ref: "#/definitions/telemetry_format"
telemetry_format:
description: SondeHub telemetry format
type: "object"
required:
- software_name
- software_version
- uploader_callsign
- time_received
- manufacturer
- type
- serial
- frame
- datetime
- lat
- lon
- alt
properties:
software_name:
description: >
Name of the decoding software
e.g. 'radiosonde_auto_rx', 'dxlAPRS', 'RS41Tracker', 'mySondy'
type: "string"
software_version:
description: >
Version of the decoding software
e.g. '1.4.0', '20210115'
type: "string"
uploader_callsign:
type: "string"
description: >
Callsign of the uploader
Arbitrary string. Uploader position information and other metadata will be handled separately, but will need to match this callsign to enable calculation of listener statistics.
time_received:
description: >
The time the telemetry packet was received. UTC time in YYYY-MM-DDTHH:MM:SS.SSSSSSZ format.
type: "string"
format: "date-time"
manufacturer:
type: "string"
description: "Radiosonde Manufacturer, as determined from the transmit modulation and high-level packet format."
enum:
- Vaisala
- Graw
- Meteomodem
- Intermet Systems
- Lockheed Martin
- Meteo-Radiy
type:
type: "string"
description: "The high-level radiosonde model, as can be determined just from the transmit modulation and high-level packet format."
enum:
- RS41
- DFM
- M10
- M20
- iMet-4
- iMet-54
- LMS6-400
- LMS6-1680
- MRZ
serial:
type: "string"
description: >
Radiosonde Serial Number. Where possible this should be in the format which matches the sticker/label on the radiosonde itself
iMet-1/iMet-4 sondes do not provide a serial number, and so auto_rx [generates](https://github.com/projecthorus/radiosonde_auto_rx/wiki/Model-Specific-Notes#intermet-imet-1--imet-4) a serial number based on launch time and transmit frequency. DFM sondes do not regularly transmit their serial number, and so data from these sondes should not be uploaded before the serial number is known.
frame:
type: "number"
format: "integer"
description: >
Frame Number, ideally unique over the entire flight. Should be taken from the telemetry. For some radiosondes (DFM, M10, M20), the datetime (converted to a unix time) is used instead of the provided frame number.
datetime:
type: "string"
format: "date-time"
description: >
Date/Time from the sonde's GPS, provided in YYYY-MM-DDTHH:MM:SS.SSSSSSZ format
Some sondes (e.g. iMet, LMS6) do not provide the date portion of the timestamp. In this situation, the date portion should be added on by the receiver. An example of how to handle this problem is [available here](https://github.com/projecthorus/radiosonde_auto_rx/blob/master/auto_rx/autorx/sonde_specific.py#L13).
lat:
description: Latitude (decimal degrees)
type: "number"
format: "double"
lon:
description: Longitude (decimal degrees)
type: "number"
format: "double"
alt:
description: Altitude (metres)
type: "number"
format: "double"
subtype:
description: Detailed Radiosonde Model Type, as determined through analysis of the telemetry.
type: "string"
enum:
- 'RS41-SG'
- 'RS41-SGP'
- 'RS41-SGM'
- 'DFM06'
- 'DFM09'
- 'DFM09P'
- 'DFM17'
- 'M10'
- 'M20'
- 'MRZ-H1'
frequency:
type: "number"
format: "float"
description: Transmit frequency of the radiosonde in MHz.
temp:
type: "number"
format: "float"
description: Measured Temperature (deg C)
humidity:
type: "number"
format: "float"
description: Measured Relative Humidity (%)
vel_h:
type: "number"
format: "float"
description: Horizontal Velocity (m/s)
vel_v:
type: "number"
format: "float"
description: Horizontal Velocity (m/s)
pressure:
description: Measured Pressure (hPa)
type: "number"
format: "float"
heading:
type: "number"
format: "float"
description: Heading (degrees True)
batt:
type: "number"
format: "float"
description: Battery Voltage (volts)
sats:
type: "number"
format: "integer"
description: Number of SVs used in position solution
xdata:
type: "string"
format: "ascii hex"
description: Auxiliary Data (e.g Ozone data) as a hexadecimal string.
snr:
type: number
format: float
description: Signal-to-Noise ratio of the received signal, in dB
rssi:
type: number
format: float
description: Received-Signal-Strength-Indication of the radiosonde signal, nominally in dBm
uploader_position:
type: array
items:
type: number
format: double
minItems: 3
maxItems: 3
description: Station position, as a list [lat, lon, alt].
uploader_antenna:
type: string
description: Station antenna/receiver information, free-text string.
listener:
type: object
properties:
software_name:
description: 'Software Name, # e.g. radiosonde_auto_rx'
type: "string"
software_version:
description: "Software version number, e.g. 1.5.1"
type: "string"
uploader_callsign:
description: "Station callsign, # e.g. CHANGEME_AUTO_RX"
type: "string"
uploader_position:
description: "Station position, as a list [lat, lon, alt] Note: This may be set to null, which will result in the station position not appearing on the map."
type: array
items:
type: number
format: double
minItems: 3
maxItems: 3
uploader_antenna:
description: Uploader's antenna description
type: "string"
uploader_contact_email:
description: "Optional contact e-mail, to assist SondeHub admins in resolving faults. e.g. user_contact_email@host.com"
type: "string"
mobile:
type: boolean
description: "Indicates that the station is mobile, and should appear as a chase car on the tracker map. Set to false if this is a fixed station."
predictions:
type: array
items:
type: object
properties:
vehicle:
type: string
description: callsign / serial of the radiosonde
time:
type: string
format: date-time
latitude:
type: number
longitude:
type: number
altitude:
type: number
ascent_rate:
type: number
descent_rate:
type: number
burst_altitude:
type: number
landed:
enum:
- 1
- 0
data:
description: This is the json output from the Tāwhirimātea predictor http://tawhiri.cusf.co.uk
type: string
externalDocs:
description: "Sondehub Infra"
url: "http://github.com/projecthorus/sondehub-infra"