Sand AISand AI MAGI-2MAGI-2 kini tersedia di SandBase: video 1080p dengan audio nativeCoba sekarang

AccuWeather Search Locations

Dokumentasi 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.

Harga
$0.01USD / panggilan
Metode
POST
Respons
JSON Asinkron
Parameter
1 wajib · 0 opsional

Playground

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

Output Anda akan muncul di sini

Lengkapi input, lalu klik Run.

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.

Jelajahi lebih lanjut

API Terkait

Semua APIs
APIHargaRespons
AccuWeather$0.01 per panggilanJSON Asinkron
AccuWeather$0.01 per panggilanJSON Asinkron
AccuWeather$0.05 per panggilanJSON Asinkron

Pertanyaan

FAQ

Bagaimana cara menggunakan API AccuWeather Search Locations?

Kirim permintaan POST ke https://api.sandbase.ai/v1/api/accuweather/search-locations dengan kunci API SandBase Anda di header Authorization (Bearer) dan parameter sebagai body JSON. Anda juga dapat mencobanya di Playground di halaman ini tanpa menulis kode.

Berapa biaya API AccuWeather Search Locations?

$0.01 per panggilan, ditagihkan dari saldo SandBase Anda. Anda hanya dikenai biaya untuk panggilan yang Anda lakukan; tidak ada langganan.

Parameter apa yang diterima API AccuWeather Search Locations?

Wajib: query (string). Tabel Parameters dan Playground di halaman ini mencantumkan setiap field.

Apa yang dikembalikan API AccuWeather Search Locations?

Hasil JSON. Endpoint ini berjalan secara asinkron, jadi responsnya memberi tahu cara mengambil hasil yang sudah selesai. README di halaman ini menyertakan contoh respons.

Apakah saya memerlukan akun developer atau kunci API AccuWeather?

Tidak. AccuWeather Search Locations berjalan melalui SandBase, jadi satu kunci API SandBase mencakup endpoint ini dan setiap API serta model lain di katalog. Anda tidak perlu mendaftar akses API AccuWeather secara terpisah.