querystring必填
Location name or query to search for (e.g., 'Istanbul', 'London', 'New York')
https://api.sandbase.ai/v1/api/accuweather/search-locationsSearch for location keys and metadata by query string. Returns matching cities with their AccuWeather location keys, geographic coordinates, timezone information, and available datasets.
您的输出将显示在这里
完成输入,然后点击运行。
This API searches AccuWeather locations by name and returns matching places. Each match includes its location Key, coordinates, time zone, and the data sets available for it. It needs one input: a query string such as London.
Key needed for other weather calls.curl -X POST "https://api.sandbase.ai/v1/api/accuweather/search-locations" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "London"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Location name or query to search for (e.g., 'Istanbul', 'London', 'New York') |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"data": {
"items": [
{
"AdministrativeArea": {
"CountryID": "GB",
"EnglishName": "London",
"EnglishType": "London Borough",
"ID": "LND",
"Level": 1,
"LocalizedName": "London",
"LocalizedType": "London Borough"
},
"Country": {
"EnglishName": "United Kingdom",
"ID": "GB",
"LocalizedName": "United Kingdom"
},
"DataSets": [
"AirQualityCurrentConditions"
],
"EnglishName": "London",
"GeoPosition": {
"Elevation": {
"Imperial": {
"Unit": "ft",
"UnitType": 0,
"Value": 59
},
"Metric": {
"Unit": "m",
"UnitType": 5,
"Value": 18
}
},
"Latitude": 51.514,
"Longitude": -0.107
},
"IsAlias": false,
"Key": "328328",
"LocalizedName": "London",
"PrimaryPostalCode": "EC4A 2",
"Rank": 10,
"Region": {
"EnglishName": "Europe",
"ID": "EUR",
"LocalizedName": "Europe"
},
"SupplementalAdminAreas": [
{
"EnglishName": "England",
"Level": 0,
"LocalizedName": "England"
}
]
}
]
},
"status": "success"
}
| Field | Meaning |
|---|---|
data.items[].Key | The location key for the match. Use this value to identify the place in other weather calls. |
data.items[].EnglishName / data.items[].LocalizedName | The name of the place in English and in the local form. |
data.items[].Type | The kind of place. In this response the value is City. |
data.items[].Country.ID / data.items[].Country.EnglishName | The country code and country name for the match. |
data.items[].AdministrativeArea.EnglishName / data.items[].AdministrativeArea.ID | The state, province or similar region that contains the place, with its short ID. |
data.items[].GeoPosition.Latitude / data.items[].GeoPosition.Longitude | The coordinates of the location. |
data.items[].GeoPosition.Elevation.Metric.Value / data.items[].GeoPosition.Elevation.Imperial.Value | The elevation of the location. The metric value is in m and the imperial value is in ft, as given by the Unit field next to each. |
data.items[].TimeZone.Name / data.items[].TimeZone.GmtOffset | The IANA time zone name and the offset from GMT. IsDaylightSaving shows if daylight saving time is active. |
data.items[].DataSets | A list of data sets available for the location, such as AirQualityCurrentConditions or Alerts. |
data.items[].Rank / data.items[].PrimaryPostalCode | Rank is a numeric rank for the match. PrimaryPostalCode is the main postal code of the place. |
query. The response can hold several places with the same name, so check Country and AdministrativeArea to pick the right one.328328. Keep them as strings.$0.01 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
开始构建
具备统一身份验证和使用情况跟踪的平台 API 端点。
curl -X POST "https://api.sandbase.ai/v1/api/accuweather/search-locations" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "London"
}'将您的 SandBase API 密钥设置到服务器环境中。请求使用 Bearer 身份验证。
export SANDBASE_API_KEY="YOUR_API_KEY"请将密钥保存在服务器端。不要在浏览器代码中暴露它。
querystring必填Location name or query to search for (e.g., 'Istanbul', 'London', 'New York')
这是该 API 保存的示例响应;查看时不会发起实时请求。
尚未发布已保存的响应。请在 Playground 中运行 API 以查看其响应。
探索更多
| API | 价格 | 响应 |
|---|---|---|
AccuWeather | $0.01 每次调用 | 异步 JSON |
AccuWeather | $0.01 每次调用 | 异步 JSON |
AccuWeather | $0.05 每次调用 | 异步 JSON |
问题
向 https://api.sandbase.ai/v1/api/accuweather/search-locations 发送 POST 请求,在 Authorization 请求头中使用您的 SandBase API key(Bearer),并将参数作为 JSON 请求体传入。您也可以直接在本页的 Playground 中试用,无需编写代码。
每次调用 $0.01,从您的 SandBase 余额中扣费。您只需为实际调用付费;无需订阅。
必填:query (string)。 Parameters 表和本页的 Playground 列出了每个字段。
JSON 结果。此端点异步运行,因此响应会告诉您如何获取已完成的结果。 本页的 README 包含一个示例响应。
不需要。AccuWeather Search Locations 通过 SandBase 运行,因此一个 SandBase API key 即可覆盖此端点以及目录中的其他所有 API 和模型。您无需单独申请 AccuWeather API 访问权限。