WeatherTrigger API

Response

By default every request returns a Yes/No response.

Request Structure

api/trigger/{Location}/{DataType} {Element} {TimePeriod} {Operator} {Value}?app_id={APP_ID}&app_key={APP_KEY}

Example: for London, is the current temperature greater than 16 degrees?

http://api.weatherunlocked.com/api/trigger/51.50,-0.12/current temperature gt 16?app_id={APP_ID}&app_key={APP_KEY}

Response

{
  "ConditionMatched": "No",
  "ConditionMatchedNum": "0",
}

Response Fields

ConditionMatched - "Yes" or "No"

ConditionMatchedNum - "1" or "0"

To return values in JSONP format:

Example: for London, is the current temperature greater than 16 degrees?

http://api.weatherunlocked.com/api/trigger/51.50,-0.12/current temperature gt 16?callback={CALLBACK_FUNCTION}&app_id={APP_ID}&app_key={APP_KEY}

Response

{CALLBACK_FUNCTION}({'ConditionMatched': 'No','ConditionMatchedNum": '0'});

To return values in XML format:

Add ?type=xml to the request

Example: for London, is the current temperature greater than 16 degrees?

http://api.weatherunlocked.com/api/trigger/51.50,-0.12/current temperature gt 16?type=xml&app_id={APP_ID}&app_key={APP_KEY}

Response

<Response>
            <ConditionMatched>No</ConditionMatched>
            <ConditionMatchedNum>0</ConditionMatchedNum>
</Response>

To return data in response in addition to yes/no, the user must add to the end of the query:

  • "includecurrent" - for current weather data
  • "include7dayforecast" - for 7 day forecast weather data

Example: including current data

http://api.weatherunlocked.com/api/trigger/51.50,-0.12/current temperature gt 16 includecurrent?app_id={APP_ID}&app_key={APP_KEY}

Response with current data

{
    "ConditionMatched": "No",
    "ConditionMatchedNum": "0",
    "CurrentWeather":
    {
        "lat": 51.55,
        "lon": -0.42,
        "alt_m": 38,
        "alt_ft": 124.67,
        "wx_desc": "Partly cloudy",
        "wx_code": 1,
        "wx_icon": "PartlyCloudyDay.gif",
        "temp_c": 11,
        "temp_f": 51.8,
        "feelslike_c": 8.17,
        "feelslike_f": 46.7,
        "humid_pct": 35,
        "windspd_mph": 16.16,
        "windspd_kmh": 26,
        "windspd_kts": 14.04,
        "windspd_ms": 7.22,
        "winddir_deg": 90,
        "winddir_compass": "E",
        "cloudtotal_pct": 50,
        "vis_km": 10,
        "vis_mi": 6,
        "vis_desc": null,
        "slp_mb": 1022,
        "slp_in": 30.26,
        "dewpoint_c": -3.81,
        "dewpoint_f": 25.14
    }
}
more details about the current weather output elements

Example: including 7 day forecast data

http://api.weatherunlocked.com/api/trigger/51.50,-0.12/forecast tomorrow temperature gt 16 include7dayforecast?app_id={APP_ID}&app_key={APP_KEY}

Response with 7 day forecast data

{
    "ConditionMatched": "No",
    "ConditionMatchedNum": "0",
    "ForecastWeather":
        {
        "Days":
            [
                {
                "date": "13/03/2015",
                "sunrise_time": "06:20",
                "sunset_time": "18:01",
                "moonrise_time": "01:06",
                "moonset_time": "10:12",
                "temp_max_c": 10.3,
                "temp_max_f": 50.5,
                "temp_min_c": 4.2,
                "temp_min_f": 39.5,
                "precip_total_mm": 0.2,
                "precip_total_in": 0,
                "rain_total_mm": 0,
                "rain_total_in": 0,
                "snow_total_mm": 0,
                "snow_total_in": 0,
                "prob_precip_pct": 99,
                "humid_max_pct": 83,
                "humid_min_pct": 54,
                "windspd_max_mph": 16,
                "windspd_max_kmh": 26,
                "windspd_max_kts": 14,
                "windspd_max_ms": 7.3,
                "windgst_max_mph": 24,
                "windgst_max_kmh": 39,
                "windgst_max_kts": 21,
                "windgst_max_ms": 10.9,
                "slp_max_in": 30.41,
                "slp_max_mb": 1026.9,
                "slp_min_in": 30.24,
                "slp_min_mb": 1021.2,
                "Timeframes":
                            [
                                {
                                "date": "13/03/2015",
                                "time": 0,
                                "utcdate": "13/03/2015",
                                "utctime": 0,
                                "wx_desc": "Partly cloudy skies",
                                "wx_code": 1,
                                "wx_icon": "PartlyCloudyNight.gif",
                                "temp_c": 7.2,
                                "temp_f": 44.9,
                                "feelslike_c": 4.1,
                                "feelslike_f": 39.4,
                                "winddir_deg": 144,
                                "winddir_compass": "SE",
                                "windspd_mph": 11,
                                "windspd_kmh": 17,
                                "windspd_kts": 9,
                                "windspd_ms": 4.8,
                                "windgst_mph": 20,
                                "windgst_kmh": 33,
                                "windgst_kts": 18,
                                "windgst_ms": 9.1,
                                "cloud_low_pct": 0,
                                "cloud_mid_pct": 30,
                                "cloud_high_pct": 100,
                                "cloudtotal_pct": 34,
                                "precip_mm": 0,
                                "precip_in": 0,
                                "rain_mm": 0,
                                "rain_in": 0,
                                "snow_mm": 0,
                                "snow_in": 0,
                                "snow_accum_cm": 0,
                                "snow_accum_in": 0,
                                "prob_precip_pct": "5",
                                "humid_pct": 70,
                                "dewpoint_c": 2.1,
                                "dewpoint_f": 35.8,
                                "vis_km": 19.7,
                                "vis_mi": 12.2,
                                "slp_mb": 1022,
                                "slp_in": 30.26
                            },
more details about the forecast weather output elements

To return values in response in addition to yes/no, the user must add "withvalue" to the end of the query:

Example: for London, is the current temperature greater than 16 degrees?

http://api.weatherunlocked.com/api/trigger/51.50,-0.12/current temperature gt 16 withvalue?app_id={APP_ID}&app_key={APP_KEY}

Response

{
  "ConditionMatched": "No",
  "ConditionMatchedNum": "0",
  "data": [
    {
      "element": "temperature",
      "value": "12"
    }
  ]
}

Response Fields

ConditionMatched - "Yes" or "No"

ConditionMatchedNum - "1" or "0"

data

element - element queried

value - value it compared the query against