Skip to content

单点查询 API

访问限制

本部分 API 属于增值服务,仅提供给企业套餐开发者,如需采购请联系彩云商务

TIP

目前支持美国地区的 CAP 气象预警信息,其他国家和地区的预警信息正在逐步增加中。

每次调用消耗接口调用额度一次。

调用方式:

bash
curl "https://singer.caiyunhub.com/v3/cap_alert/location?token={token}&longitude=-118.25&latitude=34.05&language=en-US"

请求参数:

FieldTypeRequiredDescription
longitudefloat经度
latitudefloat纬度
languagestring返回文本语言,默认值为 zh-CN

返回结构

json
{
  "alerts": [
    {
      "id": "nws-alert-1",
      "region_code": "US",
      "source": 1,
      "msg_type": 1,
      "event_name": "Flash Flood Warning",
      "categories": [2],
      "urgency": 1,
      "severity": 2,
      "certainty": 2,
      "sent_time": 1750123200,
      "effective_time": 1750123200,
      "onset_time": 1750125000,
      "expires_time": 1750130400,
      "references": [],
      "areas": [
        {
          "area_desc": "Los Angeles",
          "geocodes": [
            {
              "value_name": "UGC",
              "value": "CAC037",
              "namespace": "NWS_UGC"
            }
          ],
          "polygons": [
            {
              "vertices": [
                { "latitude": 34.11, "longitude": -118.45 },
                { "latitude": 34.10, "longitude": -118.10 },
                { "latitude": 33.90, "longitude": -118.12 }
              ]
            }
          ],
          "circles": [
            {
              "center": { "latitude": 34.05, "longitude": -118.25 },
              "radius_km": 10
            }
          ]
        }
      ],
      "language_code": "en-US",
      "sender_name": "NWS Los Angeles/Oxnard CA",
      "headline": "Flash Flood Warning issued for Los Angeles",
      "description": "Flash flooding caused by excessive rainfall is expected.",
      "instruction": "Move to higher ground immediately."
    }
  ]
}

CAPAlerts

FieldTypeDescription
alertsCAPAlert 数组CAP 气象预警记录列表

CAPAlert

FieldTypeDescription
idstring预警唯一标识,不要直接解析 id 作为业务逻辑
region_codestringISO 3166-1 Alpha-2 code
sourceint32预警来源机构,参考 CAPAlertSource
msg_typeint32CAP msgType,参考 CAPAlertMsgType
event_namestring事件名称,优先使用请求语言对应文本中的事件名称
categoriesint32 数组CAP info.category,目前只返回 Met 类型,参考 CAPAlertCategory
urgencyint32CAP info.urgency,参考 CAPAlertUrgency
severityint32CAP info.severity,参考 CAPAlertSeverity
certaintyint32CAP info.certainty,参考 CAPAlertCertainty
sent_timeint64发送时间戳(秒)
effective_timeint64生效时间戳(秒)
onset_timeint64事件开始时间戳(秒)
expires_timeint64过期时间戳(秒)
referencesstring 数组CAP references
areasCAPAlertArea 数组受影响区域
language_codestring当前返回文本的语言编码
sender_namestring发布机构名称
headlinestring标题
descriptionstring预警描述
instructionstring防御建议或行动指引

CAPAlertArea

FieldTypeDescription
area_descstring区域描述
geocodesCAPAlertGeocode 数组区域编码
polygonsCAPAlertPolygon 数组多边形范围
circlesCAPAlertCircle 数组圆形范围
altitudedoubleCAP altitude,单位为米
ceilingdoubleCAP ceiling,单位为米

CAPAlertGeocode

FieldTypeDescription
value_namestring编码名称
valuestring编码值
namespacestring编码命名空间

CAPAlertPolygon

FieldTypeDescription
verticesLatLng 数组多边形顶点,字段为 latitude/longitude

CAPAlertCircle

FieldTypeDescription
centerLatLng圆心,字段为 latitude/longitude
radius_kmdouble半径,单位为千米

CAPAlertSource

随时可能新增枚举值,代码请做好兼容处理。

NumberDescription
1US National Weather Service
2Environment and Climate Change Canada

CAPAlertMsgType

NumberDescription
1Alert
2Update
3Cancel

CAPAlertCategory

NumberDescription
1Geo
2Met
3Safety
4Security
5Rescue
6Fire
7Health
8Env
9Transport
10Infra
11CBRNE
12Other

CAPAlertUrgency

NumberDescription
1Immediate
2Expected
3Future
4Past
5Unknown

CAPAlertSeverity

NumberDescription
1Extreme
2Severe
3Moderate
4Minor
5Unknown

CAPAlertCertainty

NumberDescription
1Observed
2Likely
3Possible
4Unlikely
5Unknown