querystringobligatoire
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.
Votre sortie apparaîtra ici
Complétez les entrées, puis cliquez sur Exécuter.
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.
Commencer à construire
Point de terminaison de l'API de la plateforme avec authentification unifiée et suivi de l'utilisation.
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"
}'Définissez votre clé API SandBase dans l'environnement de votre serveur. Les requêtes utilisent l'authentification Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Conservez votre clé côté serveur. Ne l'exposez pas dans le code du navigateur.
querystringobligatoireLocation name or query to search for (e.g., 'Istanbul', 'London', 'New York')
Exemple de réponse enregistré pour cette API ; aucune requête en direct n'est effectuée lors de l'affichage.
Aucune réponse enregistrée n'a été publiée. Exécutez l'API dans Playground pour inspecter sa réponse.
Explorer plus
| API | Prix | Réponse |
|---|---|---|
AccuWeather Search LocationsCette API AccuWeather | $0.01 par appel | JSON asynchrone |
AccuWeather | $0.01 par appel | JSON asynchrone |
AccuWeather | $0.05 par appel | JSON asynchrone |
Questions
Envoyez une requête POST à https://api.sandbase.ai/v1/api/accuweather/search-locations avec votre clé API SandBase dans l’en-tête Authorization (Bearer) et les paramètres dans un corps JSON. Vous pouvez aussi l’essayer dans le Playground sur cette page sans écrire de code.
$0.01 par appel, facturé depuis votre solde SandBase. Vous ne payez que les appels que vous effectuez ; aucun abonnement.
Obligatoire : query (string). Le tableau des paramètres et le Playground sur cette page listent tous les champs.
Un résultat JSON. Ce point de terminaison s’exécute de manière asynchrone, donc la réponse vous indique comment récupérer le résultat final. Le README sur cette page inclut un exemple de réponse.
Non. AccuWeather Search Locations fonctionne via SandBase, donc une seule clé API SandBase couvre ce point de terminaison ainsi que toutes les autres API et tous les modèles du catalogue. Vous n’avez pas besoin de demander un accès API AccuWeather séparément.