Sand AISand AI MAGI-2MAGI-2 è ora su SandBase: video in 1080p con audio nativoProvalo ora

AccuWeather Search Locations

Documentazione API
https://api.sandbase.ai/v1/api/accuweather/search-locations

Search for location keys and metadata by query string. Returns matching cities with their AccuWeather location keys, geographic coordinates, timezone information, and available datasets.

Prezzo
$0.01USD / chiamata
Metodo
POST
Risposta
JSON asincrono
Parametri
1 obbligatori · 0 opzionali

Playground

Input
Location name or query to search for (e.g., 'Istanbul', 'London', 'New York')
OutputPronto

Il tuo output apparirà qui

Completa gli input, poi fai clic su Esegui.

README API

AccuWeather Search Locations

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.

Use cases

  • Convert a city name typed by a user into the location Key needed for other weather calls.
  • Tell apart places with the same name, such as London in the United Kingdom, Canada and the United States.
  • Get latitude, longitude and elevation for a city to place it on a map.
  • Check which data sets, such as air quality or alerts, exist for a location before you request them.

Request

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.

Parameters

NameTypeRequiredDescription
querystringYesLocation name or query to search for (e.g., 'Istanbul', 'London', 'New York')

Example response

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"
}

Response fields

FieldMeaning
data.items[].KeyThe location key for the match. Use this value to identify the place in other weather calls.
data.items[].EnglishName / data.items[].LocalizedNameThe name of the place in English and in the local form.
data.items[].TypeThe kind of place. In this response the value is City.
data.items[].Country.ID / data.items[].Country.EnglishNameThe country code and country name for the match.
data.items[].AdministrativeArea.EnglishName / data.items[].AdministrativeArea.IDThe state, province or similar region that contains the place, with its short ID.
data.items[].GeoPosition.Latitude / data.items[].GeoPosition.LongitudeThe coordinates of the location.
data.items[].GeoPosition.Elevation.Metric.Value / data.items[].GeoPosition.Elevation.Imperial.ValueThe 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.GmtOffsetThe IANA time zone name and the offset from GMT. IsDaylightSaving shows if daylight saving time is active.
data.items[].DataSetsA list of data sets available for the location, such as AirQualityCurrentConditions or Alerts.
data.items[].Rank / data.items[].PrimaryPostalCodeRank is a numeric rank for the match. PrimaryPostalCode is the main postal code of the place.

Notes

  • Pass the place name in query. The response can hold several places with the same name, so check Country and AdministrativeArea to pick the right one.
  • Location keys are strings, for example 328328. Keep them as strings.
  • Call AccuWeather Weather next to get weather for a location. Use AccuWeather List Cities to browse cities instead of searching by name.

Pricing

$0.01 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.

Esplora altro

API correlate

Tutte le API
APIPrezzoRisposta
AccuWeather$0.01 per chiamataJSON asincrono
AccuWeather$0.01 per chiamataJSON asincrono
AccuWeather$0.05 per chiamataJSON asincrono

Domande

FAQ

Come uso l'API AccuWeather Search Locations?

Invia una richiesta POST a https://api.sandbase.ai/v1/api/accuweather/search-locations con la tua chiave API di SandBase nell'header Authorization (Bearer) e i parametri nel body JSON. Puoi anche provarla nel Playground di questa pagina senza scrivere codice.

Quanto costa l'API AccuWeather Search Locations?

$0.01 per chiamata, addebitato dal tuo saldo SandBase. Paghi solo le chiamate che effettui; non c'è alcun abbonamento.

Quali parametri accetta l'API AccuWeather Search Locations?

Richiesti: query (string). La tabella dei parametri e il Playground di questa pagina elencano tutti i campi.

Cosa restituisce l'API AccuWeather Search Locations?

Un risultato JSON. Questo endpoint viene eseguito in modo asincrono, quindi la risposta indica come recuperare il risultato completato. Il README di questa pagina include una risposta di esempio.

Mi serve un account sviluppatore o una chiave API AccuWeather?

No. AccuWeather Search Locations funziona tramite SandBase, quindi una sola chiave API SandBase copre questo endpoint e tutte le altre API e modelli del catalogo. Non è necessario richiedere separatamente l'accesso alle API AccuWeather.