Sand AISand AI MAGI-2ตอนนี้ MAGI-2 อยู่บน SandBase แล้ว: วิดีโอ 1080p พร้อมเสียงในตัวลองใช้เลย

AccuWeather Search Locations

เอกสาร 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.

ราคา
$0.01USD / คำขอ
Method
POST
การตอบกลับ
Async JSON
พารามิเตอร์
1 จำเป็น · 0 ไม่บังคับ

Playground

อินพุต
Location name or query to search for (e.g., 'Istanbul', 'London', 'New York')
เอาต์พุตพร้อมใช้งาน

เอาต์พุตของคุณจะแสดงที่นี่

กรอกอินพุตให้ครบ แล้วคลิก Run

API README

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.

สำรวจเพิ่มเติม

APIs ที่เกี่ยวข้อง

APIs ทั้งหมด
APIราคาการตอบกลับ
AccuWeather$0.01 ต่อการเรียกAsync JSON
AccuWeather$0.01 ต่อการเรียกAsync JSON
AccuWeather$0.05 ต่อการเรียกAsync JSON

คำถาม

คำถามที่พบบ่อย

ฉันจะใช้ AccuWeather Search Locations API ได้อย่างไร?

ส่งคำขอ POST ไปที่ https://api.sandbase.ai/v1/api/accuweather/search-locations โดยใส่ SandBase API key ของคุณใน Authorization header (Bearer) และส่งพารามิเตอร์เป็น JSON body คุณยังสามารถลองใช้ได้ใน Playground บนหน้านี้โดยไม่ต้องเขียนโค้ด

AccuWeather Search Locations API ราคาเท่าไร?

$0.01 ต่อครั้ง คิดจากยอดคงเหลือ SandBase ของคุณ คุณจะถูกเรียกเก็บเฉพาะคำขอที่คุณส่งเท่านั้น ไม่มีค่าสมาชิกรายเดือน

AccuWeather Search Locations API รับพารามิเตอร์อะไรบ้าง?

ที่ต้องระบุ: query (string). ตาราง Parameters และ Playground ในหน้านี้แสดงทุกฟิลด์

AccuWeather Search Locations API ส่งคืนอะไร?

ผลลัพธ์ JSON จุดเชื่อมต่อนี้ทำงานแบบอะซิงโครนัส ดังนั้นการตอบกลับจะบอกวิธีดึงผลลัพธ์ที่เสร็จแล้ว README บนหน้านี้มีตัวอย่างการตอบกลับ

ฉันจำเป็นต้องมีบัญชีนักพัฒนาหรือ API key ของ AccuWeather ไหม?

ไม่จำเป็น AccuWeather Search Locations ทำงานผ่าน SandBase ดังนั้น SandBase API key เดียวครอบคลุม endpoint นี้และทุก API กับโมเดลอื่นในแค็ตตาล็อก คุณไม่ต้องสมัครขอสิทธิ์เข้าถึง AccuWeather API แยกต่างหาก