curl --request POST \
--url https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"city_id": "on-143"
}
'import requests
url = "https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather"
payload = { "city_id": "on-143" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({city_id: 'on-143'})
};
fetch('https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'city_id' => 'on-143'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather"
payload := strings.NewReader("{\n \"city_id\": \"on-143\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"city_id\": \"on-143\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"city_id\": \"on-143\"\n}"
response = http.request(request)
puts response.read_bodyCity weather
Weather now and the forecast for a Canadian city or a coordinate in Canada. For alerts beyond the city page use weather_alerts; for past weather use climate_daily.
curl --request POST \
--url https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"city_id": "on-143"
}
'import requests
url = "https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather"
payload = { "city_id": "on-143" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({city_id: 'on-143'})
};
fetch('https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'city_id' => 'on-143'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather"
payload := strings.NewReader("{\n \"city_id\": \"on-143\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"city_id\": \"on-143\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"city_id\": \"on-143\"\n}"
response = http.request(request)
puts response.read_bodyRequest contract
- Method and path: POST /apis/v1/api-weather-gc-ca/weather/city-weather
- Availability: enabled
- Request URL template:
https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/city-weather
{
"operationId": "api-weather-gc-ca.weather.city-weather",
"method": "POST",
"path": "/apis/v1/api-weather-gc-ca/weather/city-weather",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"examples": {
"provider": {
"summary": "Official provider example; checked against AIsa request constraints",
"value": {
"city_id": "on-143"
}
}
},
"schema": {
"additionalProperties": true,
"properties": {
"city_id": {
"description": "ECCC city page id, province code plus number: on-143 Toronto, qc-147 Montreal, bc-74 Vancouver, ab-52 Calgary, ns-19 Halifax. Find ids with find_cities. Pattern: ^[A-Za-z]{2}-[0-9A-Za-z]+$.",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body"
}
},
"include_hourly": {
"description": "Include the hourly forecast (24 hours).",
"type": "boolean",
"x-alexandria-option-metadata": {
"in": "body"
}
},
"lang": {
"default": "en",
"description": "Language of names and texts: en (English) or fr (French). Numbers are the same in both.\n\nProvider reference: allowed values [\"en\", \"fr\"]; default \"en\".",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body",
"oneOf": [
"en",
"fr"
]
}
},
"lat": {
"description": "Latitude in decimal degrees (Canada spans about 41 to 84). Give with lon.\n\nProvider reference: minimum -90; maximum 90.",
"type": "number",
"x-alexandria-option-metadata": {
"in": "body",
"max": 90,
"min": -90
}
},
"lon": {
"description": "Longitude in decimal degrees, west negative (Canada spans about -142 to -52). Give with lat.\n\nProvider reference: minimum -180; maximum 180.",
"type": "number",
"x-alexandria-option-metadata": {
"in": "body",
"max": 180,
"min": -180
}
},
"query": {
"description": "City or place name, English or French, accents optional (Toronto, Montreal, Quebec, St. John's).",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body"
}
}
},
"type": "object"
}
}
},
"required": false
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
Cost and request rules
Usage-based pricing. Default request estimate: $0.0005 USD. The final charge depends on actual usage. Your account price may differ; use a request quote where supported.Authorizations
Body
Response
Current conditions, the 6-to-7-day public forecast, the 24-hour hourly forecast, active warnings, regional normals and sunrise/sunset for one ECCC city forecast location (the data behind weather.gc.ca/en/location and the city pages), in English or French. Choose the location by city_id, by lat/lon (nearest of the ~840 ECCC forecast locations) or by name query (best match: exact name, prefix, contains, then region). An unknown city_id is not_found.
The response contains the tool result directly.
| Documented field | Provider type | Description |
|---|---|---|
attribution | string | Attribution the ECCC Data Servers End-use Licence requires when the data is republished. |
city | object | |
current | object | Latest hourly observation; null when the page has none. |
distance_km | number | Distance from lat/lon to the city location; null otherwise. |
forecast_issued_at | string | |
forecasts | object[] | Forecast periods in order (day and night). |
hourly | object[] | Hourly forecast; empty when include_hourly is false. |
hourly_issued_at | string | |
lang | string | Language of the texts. |
last_updated | string | |
licence_url | string | The ECCC Data Servers End-use Licence. |
matched_by | string | |
observed_at_ms | number | When this program read the source, epoch milliseconds. |
regional_normals | object | Normal high and low for the date. |
source_url | string | The api.weather.gc.ca request this answer was read from. |
sunrise | string | |
sunset | string | |
warnings | object[] | Warnings, watches and statements in effect for the location; empty when none. |
These are the provider's documented fields. Field requiredness, nullability and nested object structures are specified only where the descriptions explicitly say so.