Find cities
curl --request POST \
--url https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/find-cities \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "Toronto"
}
'import requests
url = "https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/find-cities"
payload = { "query": "Toronto" }
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({query: 'Toronto'})
};
fetch('https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/find-cities', 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/find-cities",
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([
'query' => 'Toronto'
]),
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/find-cities"
payload := strings.NewReader("{\n \"query\": \"Toronto\"\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/find-cities")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"Toronto\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/find-cities")
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 \"query\": \"Toronto\"\n}"
response = http.request(request)
puts response.read_body{
"attribution": "Data Source: Environment and Climate Change Canada",
"cities": [
{
"distance_km": null,
"id": "on-143",
"latitude": 43.65,
"longitude": -79.38,
"name": "Toronto",
"province": "ON",
"region": "City of Toronto",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.65,-79.38"
},
{
"distance_km": null,
"id": "on-128",
"latitude": 43.63,
"longitude": -79.39,
"name": "Toronto Island",
"province": "ON",
"region": "City of Toronto",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.63,-79.39"
},
{
"distance_km": null,
"id": "on-4",
"latitude": 43.69,
"longitude": -79.76,
"name": "Brampton",
"province": "ON",
"region": "Mississauga - Brampton",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.69,-79.76"
},
{
"distance_km": null,
"id": "on-85",
"latitude": 43.88,
"longitude": -79.26,
"name": "Markham",
"province": "ON",
"region": "Vaughan - Richmond Hill - Markham",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.88,-79.26"
},
{
"distance_km": null,
"id": "on-32",
"latitude": 43.87,
"longitude": -79.86,
"name": "Caledon",
"province": "ON",
"region": "Caledon",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.87,-79.86"
},
{
"distance_km": null,
"id": "on-68",
"latitude": 43.63,
"longitude": -79.95,
"name": "Halton Hills",
"province": "ON",
"region": "Halton Hills - Milton",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.63,-79.95"
},
{
"distance_km": null,
"id": "on-24",
"latitude": 43.59,
"longitude": -79.66,
"name": "Mississauga",
"province": "ON",
"region": "Mississauga - Brampton",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.59,-79.66"
}
],
"count": 7,
"lang": "en",
"licence_url": "https://eccc-msc.github.io/open-data/licence/readme_en/",
"observed_at_ms": 1792969237243,
"query": "Toronto",
"source_url": "https://api.weather.gc.ca/collections/citypageweather-realtime/items?f=json&q=Toronto&limit=50",
"total": 7
}Environment and Climate Change Canada weather and climate (api.weather.gc.ca)
Find cities
Before city_weather when the user names a place loosely or you need every forecast location near a point.
POST
https://api.aisa.one
/
apis
/
v1
/
api-weather-gc-ca
/
weather
/
find-cities
Find cities
curl --request POST \
--url https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/find-cities \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "Toronto"
}
'import requests
url = "https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/find-cities"
payload = { "query": "Toronto" }
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({query: 'Toronto'})
};
fetch('https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/find-cities', 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/find-cities",
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([
'query' => 'Toronto'
]),
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/find-cities"
payload := strings.NewReader("{\n \"query\": \"Toronto\"\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/find-cities")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"Toronto\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/find-cities")
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 \"query\": \"Toronto\"\n}"
response = http.request(request)
puts response.read_body{
"attribution": "Data Source: Environment and Climate Change Canada",
"cities": [
{
"distance_km": null,
"id": "on-143",
"latitude": 43.65,
"longitude": -79.38,
"name": "Toronto",
"province": "ON",
"region": "City of Toronto",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.65,-79.38"
},
{
"distance_km": null,
"id": "on-128",
"latitude": 43.63,
"longitude": -79.39,
"name": "Toronto Island",
"province": "ON",
"region": "City of Toronto",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.63,-79.39"
},
{
"distance_km": null,
"id": "on-4",
"latitude": 43.69,
"longitude": -79.76,
"name": "Brampton",
"province": "ON",
"region": "Mississauga - Brampton",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.69,-79.76"
},
{
"distance_km": null,
"id": "on-85",
"latitude": 43.88,
"longitude": -79.26,
"name": "Markham",
"province": "ON",
"region": "Vaughan - Richmond Hill - Markham",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.88,-79.26"
},
{
"distance_km": null,
"id": "on-32",
"latitude": 43.87,
"longitude": -79.86,
"name": "Caledon",
"province": "ON",
"region": "Caledon",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.87,-79.86"
},
{
"distance_km": null,
"id": "on-68",
"latitude": 43.63,
"longitude": -79.95,
"name": "Halton Hills",
"province": "ON",
"region": "Halton Hills - Milton",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.63,-79.95"
},
{
"distance_km": null,
"id": "on-24",
"latitude": 43.59,
"longitude": -79.66,
"name": "Mississauga",
"province": "ON",
"region": "Mississauga - Brampton",
"url": "https://weather.gc.ca/en/location/index.html?coords=43.59,-79.66"
}
],
"count": 7,
"lang": "en",
"licence_url": "https://eccc-msc.github.io/open-data/licence/readme_en/",
"observed_at_ms": 1792969237243,
"query": "Toronto",
"source_url": "https://api.weather.gc.ca/collections/citypageweather-realtime/items?f=json&q=Toronto&limit=50",
"total": 7
}请求规范
- 方法与路径: POST /apis/v1/api-weather-gc-ca/weather/find-cities
- 可用状态: enabled
- 请求 URL 模板:
https://api.aisa.one/apis/v1/api-weather-gc-ca/weather/find-cities
{
"operationId": "api-weather-gc-ca.weather.find-cities",
"method": "POST",
"path": "/apis/v1/api-weather-gc-ca/weather/find-cities",
"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": {
"query": "Toronto"
}
}
},
"schema": {
"additionalProperties": true,
"properties": {
"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
}
},
"limit": {
"default": 10,
"description": "limit\n\nProvider reference: minimum 1; maximum 50; default 10.",
"type": "number",
"x-alexandria-option-metadata": {
"in": "body",
"max": 50,
"min": 1
}
},
"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
}
},
"province": {
"description": "Two-letter province or territory code (ON, QC, BC, AB, MB, SK, NS, NB, NL, PE, YT, NT, NU). Pattern: ^[A-Za-z]{2}$.",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body"
}
},
"query": {
"description": "Place name, English or French.",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body"
}
},
"radius_km": {
"default": 50,
"description": "Search radius around lat/lon.\n\nProvider reference: minimum 1; maximum 100; default 50.",
"type": "number",
"x-alexandria-option-metadata": {
"in": "body",
"max": 100,
"min": 1
}
}
},
"type": "object"
}
}
},
"required": false
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
费用与请求规则
按实际用量收费。 默认请求预估费用:$0.0005 USD。 最终费用以实际用量为准。 账户适用价格可能不同;支持报价的接口可按实际请求获取报价。授权
请求体
application/json
响应
Find ECCC city forecast locations (the ids city_weather and weather_alerts take) by name or near a point. query searches names and forecast regions (English or French) and ranks exact, prefix and contains name matches first; lat/lon lists locations within radius_km sorted by distance. province narrows either. A name query with no match is not_found; a point with no location in range returns an empty list.
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. |
cities | object[] | |
count | number | |
lang | string | Language of the texts. |
licence_url | string | The ECCC Data Servers End-use Licence. |
observed_at_ms | number | When this program read the source, epoch milliseconds. |
query | string | |
source_url | string | The api.weather.gc.ca request this answer was read from. |
total | number | Matches before limit. |
These are the provider's documented fields. Field requiredness, nullability and nested object structures are specified only where the descriptions explicitly say so.