Weather Warning

Platform: API iOS Android

Get officially issued real-time severe weather warning data around the world.

Tips: For more warning description, see Resource - Warning Info.

Interface code Interface Class
warningNow Weather warning WarningResponse

Parameters

WarningNowParameter

  • location(required)The location to be queried, support LocationID or comma-separated longitude and latitude (decimal, up to 2 decimal places), LocationID can be obtained by GeoAPI. Example: location=101010100 or location=116.41,39.92
  • langMulti-language setting, please see Language to find out how our multi-language works and how to set up.

Sample code

Swift

    Task {
        do {
            let parameter = WarningNowParameter(location: "101010100")
            let response = try await QWeather.instance
                .warningNow(parameter)
            print(response)
        } catch QWeatherError.errorResponse(let error) {
            print(error)
        } catch {
            print(error)
        }
    }

Objective-C

     WarningNowParameter *parameter = [WarningNowParameter instanceWithLocation:@"101010100" lang:@(LangZH_HANS)];
    [QWeatherObjc warningNow:parameter completionHandler:^(WarningResponse * _Nullable response, NSError * _Nullable error) {
        if (response) {
            NSLog(@"%@", response.description);
        }
        if (error) {
            NSLog(@"%@", error.localizedDescription);
        }
    }];

Response

WarningResponse

  • code See Status Code
  • updateTime API last update time
  • fxLink Responsive web page of this data, for embedded in website or APP
  • warning.id The unique ID of this warning, which can be used to determine whether this warning already exists.
  • warning.sender Warning issuing unit, may be null
  • warning.pubTime Warning release time
  • warning.title Title of warning
  • warning.startTime Warning start time, may be null
  • warning.endTime End time of warning, may be null
  • warning.status Warning status
  • warning.level Warning level (deprecated), Do not use warning.level anymore, this field is deprecated and the value will be null or out of date. Please uses severity and severityColor instead
  • warning.severity Warning severity
  • warning.severityColor Preferred color for severity, may be null
  • warning.type Warning type ID
  • warning.typeName Warning type name
  • warning.urgency The urgency of the warning message, may be null
  • warning.certainty The certainty of the warning message, may be null
  • warning.text Description of the warning
  • warning.related The warning ID associated with this warning, returned when the warning status is cancel or update. May be null
  • refer.sources Data source and other statements, may be null
  • refer.license Data license, may be null

Warning Level and Type

See Warning Level and Type