Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Dtn API Endpoints API
version: '1.0'
description: 'Operations tagged API Endpoints across 2 of this provider''s published API definitions: dtn-lightning-websocket-openapi.json, dtn-observation-api-openapi.json. Each path carries the servers of the definition it was published in.'
servers:
- url: https://lightning.api.dtn.com
- url: https://obs.api.dtn.com
tags:
- name: API Endpoints
paths:
/v1/:
summary: Used to retrieve strikes based upon specific parameters on a stream delivery.
description: "- Can be used to retrieve lightning strikes by either:\n - bounding box\n - radius\n- Additional time-based filtering can be done using `startTime` - The default for time filters is the time of execution of the request."
get:
tags:
- API Endpoints
summary: Stream
description: "```\n https://lightning.api.dtn.com/v1/\n```\n\n This endpoint allows users to retrieve all lightning strikes, in a streaming manner, that match the set criteria.\n\n - Space: Observations can be searched geographically by:\n - `radius` required parameters: `lat`, `lon` and `radius`\n - `boundingBox` required parameters: `minLat`, `minLon`, `maxLat` and `maxLon`\n - Time: To stream starting on a specified time:\n - For start time, provide `startTime` value. \n - Data on the stream only last for `1 day`, any dates further can be retrieved from our other Lightning API."
security:
- clientCredentials: []
parameters:
- name: startTime
in: query
schema:
type: string
description: Get observations starting a specific time
required: false
- name: by
in: query
schema:
type: string
description: Get observations by radius | boundingBox.
required: false
- name: radius
in: query
schema:
type: number
minimum: 0
maximum: 100
description: Radius for radial search in km.
required: false
- name: lon
in: query
schema:
type: number
description: Longitude for radial search in decimal degrees, e.g. `54.85`.
required: false
- name: lat
in: query
schema:
type: number
description: Latitude for radial search in decimal degrees, e.g. `54.85`.
required: false
- name: minLon
in: query
schema:
type: string
description: Minimum longitude for boundingBox search in decimal degrees, e.g. `-1.85`
required: false
- name: minLat
in: query
schema:
type: string
description: Minimum latitude for boundingBox search in decimal degrees, e.g. `50.85`
required: false
- name: maxLon
in: query
schema:
type: string
description: Maximum longitude for boundingBox search in decimal degrees, e.g. `0.85`
required: false
- name: maxLat
in: query
schema:
type: string
description: Maximum latitude for boundingBox search in decimal degrees, e.g. `54.85`
required: false
responses:
Success:
$ref: '#/components/responses/GetStrikesDefault'
Parameter Error:
$ref: '#/components/responses/StrikeValidationError'
Server Error:
description: Internal server error.
servers:
- url: https://lightning.api.dtn.com
/v2/observations:
get:
tags:
- API Endpoints
summary: Observations
description: "Use this endpoint to get near-real time or historic observations for one or more stations (up to 100 stations per request).\n\n### Finding Stations and Parameters\n\n* Use the `/stations` endpoint to search for and identify stations of interest.\n* Use the `/parameters` endpoint to explore available parameters.\n* Observation type (`obsType`) descriptions are also listed in the `/stations` documentation.\n\n### Intervals\n\nControl the temporal resolution of the returned data with the `interval` parameter:\n\n| Interval | Description |\n|----------|-------------|\n| `15m` | Returns observations at fixed 15-minute intervals. Each value is interpolated from hourly observations. Can only be used with parameters ending in `15Min`. |\n| `1h` | Returns observations at fixed hourly intervals. Each value represents the closest measurement to the top of the hour. |\n| `24h` | Returns daily aggregations for parameters with a `24Hour` suffix. The aggregation period covers each full 24-hour window between `startTime` and `endTime`. |\n\n### Quota Usage\n\nQuota is calculated **per station**, not per request or observations.\n\n**Example**\n\nIf you request data for 10 stations, your total quota usage is:\n\n```\n10 stations = 10 quota units\n```\n\nThe number of observations returned, parameters requested, or time range does not affect quota usage—only the number of stations in your request.\n\n<details>\n<summary><strong>Deep Dive to Quota Calculations</strong></summary>\n\nThe quota is based solely on the number of stations requested, regardless of how many observations are returned.\n\n**Formula:**\n```\nTotal Quota Usage = Number of Stations Requested\n```\n\n**Example**\n\nLet's say you make a request for 3 stations with the following parameters:\n- **Stations:** `CPTR3, TQTCE, VMWB5`\n- **Parameters:** `airTemp, windSpeed, relativeHumidity` (3 parameters)\n- **Time Range:** 24 hours with hourly data (24 time points)\n\nTotal quota usage:\n```\n3 stations = 3 quota units\n```\n\n**Key Points:**\n- Quota is counted per station requested, not per observation\n- The number of parameters does not affect quota\n- The time range does not affect quota\n- The number of observations returned does not affect quota\n- The number of API requests doesn't affect quota—only the number of stations requested\n\n</details>\n\n### Access Scopes and Data Availability\n\n| Feature | Core Scope | Plus Scope |\n|---------|------------|------------|\n| **Parameters** | Access limited to Core parameters only. Including non-Core parameters (e.g., `soilTemp`, `surfaceTemp`) will not change the response. | Access to all parameters, both Core and Non-Core. |\n| **Stations** | Data limited to public stations, excluding DTN EU stations. | Includes data from all stations, including DTN EU. |\n| **Data Access** | Only latest data (past 32 days) is available. | Supports both latest and archived observations (dating back to 1901). |\n\n### Gap Filling with Model Data\n\n**What is Gap Filling?**\n\nFills missing observations with data from DTN's gridded weather model.\n\n**Important:** When `gapFill=true`, the `obsProperties` parameter is automatically set to `true` by default to help you identify which observations are gap-filled.\n\n<details>\n<summary><strong>Deep Dive to Gap Filling</strong></summary>\n\n**When to Use:**\n- Creating continuous time series for analysis\n- Machine learning training datasets\n- Filling short data gaps in station records\n\n**Requirements:**\n- Gap-filling scope enabled on your account\n- Use with `interval=1h`\n- Available from January 1, 2013 onwards\n\n**Supported Parameters:**\n\nNot all parameters support gap filling. Check the `/parameters` endpoint for details.\n\n**Example:**\n```\nGET /v2/observations?stationCode=CPTR3¶meters=airTemp,windSpeed&startTime=2025-01-20T00:00:00Z&endTime=2025-01-22T00:00:00Z&interval=1h&gapFill=true\n```\n\n**Identifying Gap-Filled Data:**\n\nWhen `gapFill=true`, observation properties are automatically included in the response. Gap-filled observations will have specific indicators in the properties to distinguish them from actual station measurements.\n\n**Response Comparison:**\n\n**Without Gap Filling (`gapFill=false` or omitted):**\n\nMissing data at 11:00 creates a gap in the time series.\n\n```json\n{\n \"properties\": {\n \"2025-01-20T10:00:00Z\": {\n \"airTemp\": 15.5\n },\n \"2025-01-20T12:00:00Z\": {\n \"airTemp\": 17.2\n }\n }\n}\n```\n\n**With Gap Filling (`gapFill=true`):**\n\nGap at 11:00 is filled with model data, indicated by `\"obsType\": \"MODEL\"`.\n\n```json\n{\n \"properties\": {\n \"2025-01-20T10:00:00Z\": {\n \"airTemp\": 15.5,\n \"airTempProperties\": {\n \"obsType\": \"METAR\",\n \"isDerived\": false,\n \"qc\": \"pass\"\n }\n },\n \"2025-01-20T11:00:00Z\": {\n \"airTemp\": 16.3,\n \"airTempProperties\": {\n \"obsType\": \"MODEL\"\n }\n },\n \"2025-01-20T12:00:00Z\": {\n \"airTemp\": 17.2,\n \"airTempProperties\": {\n \"obsType\": \"METAR\",\n \"isDerived\": false,\n \"qc\": \"pass\"\n }\n }\n }\n}\n```\n\n**Key Difference:** Gap-filled observations have `\"obsType\": \"MODEL\"` in the properties, while actual station measurements show the observation type (e.g., `\"METAR\"`, `\"SYNOP\"`).\n\n</details>\n\n### Time Zones and Timestamps\n\n**All Times are in UTC**\n\n**Important:** All timestamps in requests and responses use UTC (Coordinated Universal Time).\n\n**Request Format:**\n- Use ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ` or `YYYY-MM-DDTHH:MM:SS`\n- The `Z` suffix explicitly indicates UTC time, but timestamps without `Z` are also treated as UTC\n- Examples: `2025-01-22T14:30:00Z` or `2025-01-22T14:30:00`\n\n<details>\n<summary><strong>Deep Dive to Time Zones and Timestamps</strong></summary>\n\n**Converting Local Time to UTC**\n\nIf you need data for a specific local time:\n1. Convert your local time to UTC\n2. Use the UTC time in your API request\n\n**Example:**\n- Local time: January 22, 2025, 9:00 AM EST (UTC-5)\n- UTC time: January 22, 2025, 2:00 PM UTC\n- API parameter: `startTime=2025-01-22T14:00:00Z` or `startTime=2025-01-22T14:00:00`\n\n**Daily Aggregations and Time Zones**\n\nWhen using `interval=24h`, the aggregation period is determined by your `startTime`:\n\n**Midnight-to-Midnight Aggregation:**\n- Set `startTime` to midnight in your desired timezone (expressed in UTC)\n- Example for EST (UTC-5): `startTime=2025-01-22T05:00:00Z` (midnight EST)\n\n**Understanding `aggregationTimeLabel`:**\n- `end` (default): Timestamp represents the end of the 24-hour period\n- `start`: Timestamp represents the start of the 24-hour period\n\n**Example:**\n```\nstartTime=2025-01-22T00:00:00Z\nendTime=2025-01-25T00:00:00Z\ninterval=24h\naggregationTimeLabel=end\n```\n\nReturns data for:\n- `2025-01-23T00:00:00Z` (data from Jan 22 00:00 to Jan 23 00:00)\n- `2025-01-24T00:00:00Z` (data from Jan 23 00:00 to Jan 24 00:00)\n- `2025-01-25T00:00:00Z` (data from Jan 24 00:00 to Jan 25 00:00)\n\n</details>\n\n### Data Quality and QC Flags\n\n**Understanding Quality Control**\n\nDTN applies automated quality control checks to all observations to identify potentially erroneous data.\n\n**QC Flag Values:**\n- `pass`: Observation passed all quality checks\n- `suspicious`: Observation flagged as potentially questionable\n- `fail`: Observation failed quality checks\n\n<details>\n<summary><strong>Deep Dive to QC Flags</strong></summary>\n\n**Viewing QC Flags**\n\nSet `obsProperties=true` to include QC information in the response.\n\n**Example Response:**\n```json\n{\n \"timestamp\": \"2025-01-22T12:00:00Z\",\n \"airTemp\": 45.2,\n \"properties\": {\n \"airTemp\": {\n \"qc\": \"suspicious\",\n \"obsType\": \"METAR\",\n \"isDerived\": false\n }\n }\n}\n```\n\n**Filtering by Quality**\n\n**Get Only Good Data:**\n\nUse `onlyGood=true` to automatically filter out observations that failed QC.\n\n```\nGET /v2/observations?stationCode=CPTR3¶meters=airTemp&startTime=2025-01-22T00:00:00Z&endTime=2025-01-22T23:59:59Z&onlyGood=true\n```\n\n**Derived Parameters**\n\nSome parameters are calculated from other measurements:\n\n**isDerived Flag:**\n- `true`: Value calculated by DTN (e.g., `relativeHumidity` from `dewPoint` and `airTemp`)\n- `false`: Direct measurement from the station\n\n**Common Derived Parameters:**\n- `relativeHumidity` (from `dewPoint` and `airTemp`)\n- `heatIndex` (from `airTemp` and `relativeHumidity`)\n- `windChill` (from `airTemp` and `windSpeed`)\n\n**Historical Data Limitations**\n\n**Note:** QC flags and observation properties may not be available for archived historical data.\n\n- Latest data (past 32 days): Full QC information available\n- Archived data (older than 32 days): Limited or no QC information\n\n</details>\n\n### Station Tags (showTags Parameter)\n\n**What are Station Tags?**\n\nStation tags contain metadata about observation stations, including identifying information such as station name and management ID. By default, tags are not included in the response to maintain backward compatibility.\n\n**When to Use:**\n\nUse `showTags=true` when you need to display station information alongside observations, such as:\n- Plotting observations on a map with station names\n- Creating reports that identify data sources\n- Correlating observations with station metadata without additional API calls\n\n**How It Works:**\n\n- `showTags=false` (default): Response excludes tags, keeping payload minimal\n- `showTags=true`: Each feature includes a `tags` object with station metadata\n\n**Tag Structure:**\n\nWhen included, tags contain at minimum:\n- `name`: Human-readable station name\n- `mgID`: Management ID for the station\n\n**Example Comparison:**\n\n**Without Tags (`showTags=false` or omitted):**\n```json\n{\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [-0.45, 51.4833]\n },\n \"properties\": {\n \"2025-01-22T00:00:00Z\": {\n \"airTemp\": 3,\n \"windSpeed\": 2.06\n }\n }\n}\n```\n\n**With Tags (`showTags=true`):**\n```json\n{\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [-0.45, 51.4833]\n },\n \"properties\": {\n \"tags\": {\n \"name\": \"London Weather Station\",\n \"mgID\": \"LDN001\"\n },\n \"2025-01-22T00:00:00Z\": {\n \"airTemp\": 3,\n \"windSpeed\": 2.06\n }\n }\n}\n```\n\n**Use Cases:**\n\n1. **Weather Dashboards**: Display station names alongside real-time observations\n2. **Data Analysis**: Identify observation sources in reports and visualizations\n3. **Mobile Apps**: Show user-friendly station names in weather apps\n4. **Integration**: Reduce API calls by getting station info with observations\n\n### Example Request\n\n```\nGET https://obs.api.dtn.com/v2/observations?stationCode=CPTR3¶meters=airTemp,windSpeed,wbgt&startTime=2025-01-22T00:00:00Z&endTime=2025-01-22T01:00:00Z&obsProperties=true\n```\n\n**With Station Tags:**\n\n```\nGET https://obs.api.dtn.com/v2/observations?stationCode=CPTR3¶meters=airTemp,windSpeed&startTime=2025-01-22T00:00:00Z&endTime=2025-01-22T01:00:00Z&showTags=true\n```\n\n### Notes\n\n* Maximum of 100 stations per request.\n* For detailed parameter definitions, see the `/parameters` endpoint documentation.\n* Station tags are included in the response only when `showTags=true` is explicitly set."
operationId: get_observations_v2_observations_get
parameters:
- description: Comma-separated list of parameters, e.g. `airTemp,precipAcc60Min,windSpeed`. A full list of supported parameters and definitions is available through the parameters endpoint.
required: true
schema:
title: Parameters
type: string
description: Comma-separated list of parameters, e.g. `airTemp,precipAcc60Min,windSpeed`. A full list of supported parameters and definitions is available through the parameters endpoint.
name: parameters
in: query
- description: Start of the time range, in the format `2023-04-30T19:00:00Z`
required: true
schema:
title: Starttime
type: string
description: Start of the time range, in the format `2023-04-30T19:00:00Z`
format: date-time
name: startTime
in: query
- description: End of the time range, in the format `2023-04-30T19:00:00Z`. Limited to 1 month per query.
required: true
schema:
title: Endtime
type: string
description: End of the time range, in the format `2023-04-30T19:00:00Z`. Limited to 1 month per query.
format: date-time
name: endTime
in: query
- description: Comma-separated list of up to 100 DTN station codes, e.g. `YNQXX,CPTR3,KNYC1`. You can request observations for multiple stations at once (maximum 100).
required: true
schema:
title: Stationcode
type: string
description: Comma-separated list of up to 100 DTN station codes, e.g. `YNQXX,CPTR3,KNYC1`. You can request observations for multiple stations at once (maximum 100).
name: stationCode
in: query
- description: Comma-separated list of obsTypes, e.g. `METAR,SYNOP,RWIS,AG` If unspecified, all types are shown.
required: false
schema:
title: Obstypes
type: string
description: Comma-separated list of obsTypes, e.g. `METAR,SYNOP,RWIS,AG` If unspecified, all types are shown.
name: obsTypes
in: query
- description: Set to `True` to hide observations that have failed QC. QC flags may not be available for historic data.
required: false
schema:
title: Onlygood
type: boolean
description: Set to `True` to hide observations that have failed QC.
default: false
name: onlyGood
in: query
- description: 'Set to `True` to view properties such as `qc` flag (result of checks: pass, suspicious or fail), `obsType` (see parameters endpoint documentation) and `isDerived` (True if the value is calculated by us from other parameters e.g. relativeHumidity from dewPoint and airTemp). Properties may not be available for historic data.'
required: false
schema:
title: Obsproperties
type: boolean
description: 'Set to `True` to view properties such as `qc` flag (result of checks: pass, suspicious or fail), `obsType` (see parameters endpoint documentation) and `isDerived` (True if the value is calculated by us from other parameters e.g. relativeHumidity from dewPoint and airTemp). Properties may not be available for historic data.'
name: obsProperties
in: query
- description: Set to `True` to include station tags (such as name and management ID) in the response. When set to `True`, each feature in the response will include a `tags` object containing station metadata. Default is `False` to maintain backward compatibility.
required: false
schema:
title: ShowTags
type: boolean
description: Set to `True` to include station tags (such as name and management ID) in the response. When set to `True`, each feature in the response will include a `tags` object containing station metadata. Default is `False` to maintain backward compatibility.
default: false
name: showTags
in: query
- description: Set to `15m` for 15-minute intervals, `1h` for hourly, `24h` for daily, or exclude for all observations received from the station. 15-minute interval data will be calculated on the fly and can only be used with parameters that end in the `15Min` suffix. Daily aggregated data will be calculated on the fly and the definition of 1 day is determined by the startTime. To get data aggregated from midnight to midnight, set the start time to your local midnight (expressed in UTC). Can only be used with parameters that end in the `24Hour` suffix. Data is representative of the 24 hours before the given timestamp. E.g. airTempMax24Hour at 2024-09-10T00:00 is the maximum temperature for the 9th September UTC day.
required: false
schema:
type: string
pattern: (^15m$|^1h$|^24h$)
title: Interval
description: Set to `15m` for 15-minute intervals, `1h` for hourly, `24h` for daily, or exclude for all observations received from the station. 15-minute interval data will be calculated on the fly and can only be used with parameters that end in the `15Min` suffix. Daily aggregated data will be calculated on the fly and the definition of 1 day is determined by the startTime. To get data aggregated from midnight to midnight, set the start time to your local midnight (expressed in UTC). Can only be used with parameters that end in the `24Hour` suffix. Data is representative of the 24 hours before the given timestamp. E.g. airTempMax24Hour at 2024-09-10T00:00 is the maximum temperature for the 9th September UTC day.
name: interval
in: query
- description: Set to `True` to fill gaps in hourly time-series with values from our gridded weather model. Hourly model data is available up to 10 years in the past for all locations and selected parameters. Requires gap-filling scope.
required: false
schema:
type: boolean
title: Gapfill
description: Set to `True` to fill gaps in hourly time-series with values from our gridded weather model. Hourly model data is available from 1st January 2013 for all locations and selected parameters. Requires gap-filling scope.
default: false
name: gapFill
in: query
- description: Set to `us-std` to change units from `si-std` to Imperial Units. Default value is `si-std`
required: false
schema:
title: Units
pattern: (^si-std$|^us-std$)
type: string
description: Set to `us-std` to change units from `si-std` to Imperial Units. Default value is `si-std`
default: si-std
name: units
in: query
- description: 'Specifies how the timestamp is labeled in the response when using time-aggregated data (e.g., `interval=24h`).
This parameter controls whether the timestamp returned for each data point reflects the start or end of the aggregation window.
Supported values:
`end` (default) - The timestamp represents the end of the aggregation period.
`start` - The timestamp represents the start of the aggregation period.
Note: This parameter is only applicable when interval=24h.'
required: false
schema:
title: aggregationTimeLabel
pattern: (^start$|^end$)
type: string
description: 'Specifies how the timestamp is labeled in the response when using time-aggregated data (e.g., `interval=24h`).
This parameter controls whether the timestamp returned for each data point reflects the start or end of the aggregation window.
Supported values:
`end` (default) - The timestamp represents the end of the aggregation period.
`start` - The timestamp represents the start of the aggregation period.
Note: This parameter is only applicable when interval=24h.'
default: end
name: aggregationTimeLabel
in: query
responses:
'200':
description: Successful Response
content:
application/json:
schema:
title: Response Get Observations V2 Observations Get
type: array
items:
$ref: '#/components/schemas/ObsDataRespModel'
examples:
Observations Endpoint Core Scope:
$ref: '#/components/examples/Observations_Endpoint_Core_Scope'
Observations Endpoint Plus Scope:
$ref: '#/components/examples/Observations_Endpoint_Plus_Scope'
Observations with showTags=true:
$ref: '#/components/examples/Observations_with_showTags_true'
Observations with showTags=false:
$ref: '#/components/examples/Observations_with_showTags_false'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthorizedError'
'422':
description: Unprocessable Entity
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
'504':
description: Gateway Timeout
content:
application/json:
schema:
$ref: '#/components/schemas/GatewayTimeoutError'
security:
- clientCredentials: []
x-codeSamples:
- lang: C + Libcurl
source: "#include <stdio.h>\n#include <curl/curl.h>\n\nint main(void) {\n CURL *curl;\n CURLcode res;\n \n curl = curl_easy_init();\n if(curl) {\n struct curl_slist *headers = NULL;\n headers = curl_slist_append(headers, \"Authorization: Bearer YOUR_ACCESS_TOKEN\");\n \n curl_easy_setopt(curl, CURLOPT_URL, \n \"https://obs.api.dtn.com/v2/observations?\"\n \"stationCode=CPTR3&\"\n \"parameters=airTemp,windSpeed&\"\n \"startTime=2025-01-22T00:00:00Z&\"\n \"endTime=2025-01-22T12:00:00Z\");\n curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);\n \n res = curl_easy_perform(curl);\n \n curl_slist_free_all(headers);\n curl_easy_cleanup(curl);\n }\n return 0;\n}"
- lang: Csharp + Restsharp
source: "using RestSharp;\nusing System;\n\nclass Program\n{\n static void Main()\n {\n var client = new RestClient(\"https://obs.api.dtn.com\");\n var request = new RestRequest(\"/v2/observations\", Method.Get);\n \n request.AddHeader(\"Authorization\", \"Bearer YOUR_ACCESS_TOKEN\");\n request.AddParameter(\"stationCode\", \"CPTR3\");\n request.AddParameter(\"parameters\", \"airTemp,windSpeed\");\n request.AddParameter(\"startTime\", \"2025-01-22T00:00:00Z\");\n request.AddParameter(\"endTime\", \"2025-01-22T12:00:00Z\");\n \n var response = client.Execute(request);\n Console.WriteLine(response.Content);\n }\n}"
- lang: Go + Native
source: "package main\n\nimport (\n \"fmt\"\n \"io\"\n \"net/http\"\n \"net/url\"\n)\n\nfunc main() {\n baseURL := \"https://obs.api.dtn.com/v2/observations\"\n \n params := url.Values{}\n params.Add(\"stationCode\", \"CPTR3\")\n params.Add(\"parameters\", \"airTemp,windSpeed\")\n params.Add(\"startTime\", \"2025-01-22T00:00:00Z\")\n params.Add(\"endTime\", \"2025-01-22T12:00:00Z\")\n \n req, _ := http.NewRequest(\"GET\", baseURL+\"?\"+params.Encode(), nil)\n req.Header.Add(\"Authorization\", \"Bearer YOUR_ACCESS_TOKEN\")\n \n client := &http.Client{}\n resp, _ := client.Do(req)\n defer resp.Body.Close()\n \n body, _ := io.ReadAll(resp.Body)\n fmt.Println(string(body))\n}"
- lang: Java + Okhttp
source: "import okhttp3.OkHttpClient;\nimport okhttp3.Request;\nimport okhttp3.Response;\n\npublic class ObservationsExample {\n public static void main(String[] args) throws Exception {\n OkHttpClient client = new OkHttpClient();\n \n String url = \"https://obs.api.dtn.com/v2/observations?\" +\n \"stationCode=CPTR3&\" +\n \"parameters=airTemp,windSpeed&\" +\n \"startTime=2025-01-22T00:00:00Z&\" +\n \"endTime=2025-01-22T12:00:00Z\";\n \n Request request = new Request.Builder()\n .url(url)\n .addHeader(\"Authorization\", \"Bearer YOUR_ACCESS_TOKEN\")\n .build();\n \n try (Response response = client.newCall(request).execute()) {\n System.out.println(response.body().string());\n }\n }\n}"
- lang: Java + Unirest
source: "import kong.unirest.Unirest;\nimport kong.unirest.HttpResponse;\n\npublic class ObservationsExample {\n public static void main(String[] args) {\n HttpResponse<String> response = Unirest.get(\"https://obs.api.dtn.com/v2/observations\")\n .header(\"Authorization\", \"Bearer YOUR_ACCESS_TOKEN\")\n .queryString(\"stationCode\", \"CPTR3\")\n .queryString(\"parameters\", \"airTemp,windSpeed\")\n .queryString(\"startTime\", \"2025-01-22T00:00:00Z\")\n .queryString(\"endTime\", \"2025-01-22T12:00:00Z\")\n .asString();\n \n System.out.println(response.getBody());\n }\n}"
- lang: Javascript + Jquery
source: "$.ajax({\n url: 'https://obs.api.dtn.com/v2/observations',\n method: 'GET',\n headers: {\n 'Authorization': 'Bearer YOUR_ACCESS_TOKEN'\n },\n data: {\n stationCode: 'CPTR3',\n parameters: 'airTemp,windSpeed',\n startTime: '2025-01-22T00:00:00Z',\n endTime: '2025-01-22T12:00:00Z'\n },\n success: function(data) {\n console.log(data);\n },\n error: function(error) {\n console.error(error);\n }\n});"
- lang: Javascript + Xhr
source: "const xhr = new XMLHttpRequest();\nconst params = new URLSearchParams({\n stationCode: 'CPTR3',\n parameters: 'airTemp,windSpeed',\n startTime: '2025-01-22T00:00:00Z',\n endTime: '2025-01-22T12:00:00Z'\n});\n\nxhr.open('GET', `https://obs.api.dtn.com/v2/observations?${params}`);\nxhr.setRequestHeader('Authorization', 'Bearer YOUR_ACCESS_TOKEN');\n\nxhr.onload = function() {\n if (xhr.status === 200) {\n console.log(JSON.parse(xhr.responseText));\n }\n};\n\nxhr.send();"
- lang: Node + Native
source: "const https = require('https');\nconst querystring = require('querystring');\n\nconst params = querystring.stringify({\n stationCode: 'CPTR3',\n parameters: 'airTemp,windSpeed',\n startTime: '2025-01-22T00:00:00Z',\n endTime: '2025-01-22T12:00:00Z'\n});\n\nconst options = {\n hostname: 'obs.api.dtn.com',\n path: `/v2/observations?${params}`,\n method: 'GET',\n headers: {\n 'Authorization': 'Bearer YOUR_ACCESS_TOKEN'\n }\n};\n\nconst req = https.request(options, (res) => {\n let data = '';\n res.on('data', (chunk) => data += chunk);\n res.on('end', () => console.log(JSON.parse(data)));\n});\n\nreq.end();"
- lang: Node + Request
source: "const request = require('request');\n\nconst options = {\n url: 'https://obs.api.dtn.com/v2/observations',\n headers: {\n 'Authorization': 'Bearer YOUR_ACCESS_TOKEN'\n },\n qs: {\n stationCode: 'CPTR3',\n parameters: 'airTemp,windSpeed',\n startTime: '2025-01-22T00:00:00Z',\n endTime: '2025-01-22T12:00:00Z'\n },\n json: true\n};\n\nrequest.get(options, (error, response, body) => {\n if (!error && response.statusCode === 200) {\n console.log(body);\n }\n});"
- lang: Objc + Nsurlsession
source: "#import <Foundation/Foundation.h>\n\nNSString *urlString = @\"https://obs.api.dtn.com/v2/observations?stationCode=CPTR3¶meters=airTemp,windSpeed&startTime=2025-01-22T00:00:00Z&endTime=2025-01-22T12:00:00Z\";\nNSURL *url = [NSURL URLWithString:urlString];\n\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];\n[request setHTTPMethod:@\"GET\"];\n[request setValue:@\"Bearer YOUR_ACCESS_TOKEN\" forHTTPHeaderField:@\"Authorization\"];\n\nNSURLSession *session = [NSURLSession sharedSession];\nNSURLSessionDataTask *task = [session dataTaskWithRequest:request\n completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {\n if (!error) {\n NSString *result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];\n NSLog(@\"%@\", result);\n }\n }];\n[task resume];"
- lang: Ocaml + Cohttp
source: "open Lwt\nopen Cohttp\nopen Cohttp_lwt_unix\n\nlet uri = Uri.of_string \n \"https://obs.api.dtn.com/v2/observations?stationCode=CPTR3¶meters=airTemp,windSpeed&startTime=2025-01-22T00:00:00Z&endTime=2025-01-22T12:00:00Z\"\n\nlet headers = Header.init ()\n |> fun h -> Header.add h \"Authorization\" \"Bearer YOUR_ACCESS_TOKEN\"\n\nlet () =\n let body = Client.get ~headers uri >>= fun (resp, body) ->\n body |> Cohttp_lwt.Body.to_string >|= fun body ->\n print_endline body\n in\n Lwt_main.run body"
- lang: Php + Curl
source: "<?php\n$ch = curl_init();\n\n$params = http_build_query([\n 'stationCode' => 'CPTR3',\n 'parameters' => 'airTemp,windSpeed',\n 'startTime' => '2025-01-22T00:00:00Z',\n 'endTime' => '2025-0
# --- truncated at 32 KB (155 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/dtn/refs/heads/main/openapi/dtn-api-endpoints-api-openapi.yml