Weather Alerts

We invite you to try our new product - the weather alerts which are based on our meteorological data.

Now you can use simple syntax and a few API methods to create triggers which will fire on an occurrence of the selected weather conditions (temperature, humidity, pressure, etc.) in a specified period of time. For example, if you are interested in the forthcoming frosts or the probability of a wind speed increase in a certain place, you can obtain this information with the help of our new tool. More detailed description about working with the service is given below.

If the trigger's conditions are met, our service will generate an alert. In order to receive this alert you need to poll the service with the specified time interval. We plan to add push notifications and new data sources to this product's functionality in the nearest future.

Three simple steps for working with Weather Triggers API:

1 Create an account in members area and receive a key to access API.

2 Create the trigger with the necessary conditions for temperature, pressure, humidity, wind speed, wind direction and clouds.

3 Poll our service and receive information about an occurrence or a forecast of the upcoming events in which you are interested.


Weather Triggers API basic methods to retrieve alerts from the service:

Minimal prerequisites to start working with our service: create a trigger and receive a list of the current alerts. For the access to all API methods it is necessary to specify your personal key.


[POST] /triggers

This method is used to create a trigger with the necessary conditions and the indication of an interval for observations.

URL Example

http://api.openweathermap.org/data/3.0/triggers

API Request
{
   "time_period":{
      "start":{
         "expression":"after",
         "amount":132000000
      },
      "end":{
         "expression":"after",
         "amount":432000000
      }
   },
   "conditions":[
      {
         "name":"temp",
         "expression":"$gt",
         "amount":299
      }
   ],
   "area":[
      {
         "type":"Point",
         "coordinates":[
            53,
            37
         ]
      }
   ]
}
API Response
{
   "__v":0,
   "_id":"585268b72516b90010058184",
   "alerts":{

   },
   "area":[
      {
         "type":"Point",
         "_id":"585268b72516b90010058185",
         "coordinates":[
            53,
            37
         ]
      }
   ],
   "conditions":[
      {
         "name":"temp",
         "expression":"$gt",
         "amount":299,
         "_id":"585268b72516b90010058186"
      }
   ],
   "time_period":{
      "end":{
         "expression":"after",
         "amount":432000000
      },
      "start":{
         "expression":"after",
         "amount":132000000
      }
   }
}

A full description of the returned data structure and the list of parameters can be found here.

Headers: Content-Type: application/json


[GET] /triggers/{:id}

This method is used to get all information about a trigger, including the current alerts. Information about an occurence of the expected events is in an alert's nested structure. The trigger calls a separate method for receiving history notifications.

URL Example

http://api.openweathermap.org/data/3.0/triggers/5852816a9aaacb00153134a3

API Response

{
   "_id":"5852816a9aaacb00153134a3",
   "__v":0,
   "alerts":{
      "8b48b2cd21c23d2894466caccba1ed1f":{
         "conditions":[
            {
               "current_value":{
                  "min":263.576,
                  "max":263.576
               },
               "condition":{
                  "name":"temp",
                  "expression":"$lt",
                  "amount":273,
                  "_id":"5852816a9aaacb00153134a5"
               }
            }
         ],
         "last_update":1481802090232,
         "date":1482181200000,
         "coordinates":{
            "lon":37,
            "lat":53
         }
      }
   },
   "area":[
      {
         "type":"Point",
         "_id":"5852816a9aaacb00153134a4",
         "coordinates":[
            37,
            53
         ]
      }
   ],
   "conditions":[
      {
         "name":"temp",
         "expression":"$lt",
         "amount":273,
         "_id":"5852816a9aaacb00153134a5"
      }
   ],
   "time_period":{
      "end":{
         "amount":432000000,
         "expression":"after"
      },
      "start":{
         "amount":132000000,
         "expression":"after"
      }
   }
}

A full description of the returned data structure and the list of parameters can be found here.


Additional features of Weather Triggers API:

Allows you to get a list of all triggers, change and remove them, receive and manage alerts history.


[GET] /triggers

The method is used to get a list of all triggers (with the current alerts) which are connected to your account.

URL Example

http://api.openweathermap.org/data/3.0/triggers

API Response

[
   {
      "_id":"585268b72516b90010058184",
      "__v":0,
      "alerts":{

      },
      "area":[
         {
            "type":"Point",
            "_id":"585268b72516b90010058185",
            "coordinates":[
               53,
               37
            ]
         }
      ],
      "conditions":[
         {
            "name":"temp",
            "expression":"$gt",
            "amount":299,
            "_id":"585268b72516b90010058186"
         }
      ],
      "time_period":{
         "end":{
            "expression":"after",
            "amount":432000000
         },
         "start":{
            "expression":"after",
            "amount":132000000
         }
      }
   },
   {
      "_id":"585280edbe54110025ea52bb",
      "__v":0,
      "alerts":{

      },
      "area":[
         {
            "type":"Point",
            "_id":"585280edbe54110025ea52bc",
            "coordinates":[
               53,
               37
            ]
         }
      ],
      "conditions":[
         {
            "name":"temp",
            "expression":"$lt",
            "amount":273,
            "_id":"585280edbe54110025ea52bd"
         }
      ],
      "time_period":{
         "end":{
            "amount":432000000,
            "expression":"after"
         },
         "start":{
            "amount":132000000,
            "expression":"after"
         }
      }
   },
   {
      "_id":"5852816a9aaacb00153134a3",
      "__v":0,
      "alerts":{
         "8b48b2cd21c23d2894466caccba1ed1f":{
            "conditions":[
               {
                  "current_value":{
                     "min":263.576,
                     "max":263.576
                  },
                  "condition":{
                     "name":"temp",
                     "expression":"$lt",
                     "amount":273,
                     "_id":"5852816a9aaacb00153134a5"
                  }
               }
            ],
            "last_update":1481802090232,
            "date":1482181200000,
            "coordinates":{
               "lon":37,
               "lat":53
            }
         }
      },
      "area":[
         {
            "type":"Point",
            "_id":"5852816a9aaacb00153134a4",
            "coordinates":[
               37,
               53
            ]
         }
      ],
      "conditions":[
         {
            "name":"temp",
            "expression":"$lt",
            "amount":273,
            "_id":"5852816a9aaacb00153134a5"
         }
      ],
      "time_period":{
         "end":{
            "amount":432000000,
            "expression":"after"
         },
         "start":{
            "amount":132000000,
            "expression":"after"
         }
      }
   }
]

A full description of the returned data structure and the list of parameters can be found here.


[PUT] /triggers/{:id}

This method is used to change a trigger's parameters.

IMPORTANT! If the trigger is changed, all related current alerts will be removed.

URL Example

http://api.openweathermap.org/data/3.0/triggers/585280edbe54110025ea52bb

API Request
{
   "time_period":{
      "start":{
         "expression":"after",
         "amount":132000000
      },
      "end":{
         "expression":"after",
         "amount":132000000
      }
   },
   "conditions":[
      {
         "name":"temp",
         "expression":"$lt",
         "amount":270
      }
   ],
   "area":[
      {
         "type":"Point",
         "coordinates":[
            53,
            37
         ]
      }
   ]
}
API Response
{
   "_id":"585268b72516b90010058184",
   "__v":1,
   "alerts":{

   },
   "area":[
      {
         "type":"Point",
         "_id":"58528903d083a2001b7cb428",
         "coordinates":[
            53,
            37
         ]
      }
   ],
   "conditions":[
      {
         "name":"temp",
         "expression":"$lt",
         "amount":270,
         "_id":"58528903d083a2001b7cb427"
      }
   ],
   "time_period":{
      "start":{
         "expression":"after",
         "amount":132000000
      },
      "end":{
         "expression":"after",
         "amount":132000000
      }
   }
}relax

A full description of the returned data structure and the list of parameters can be found here.

Headers: Content-Type: application/json


[DELETE] /triggers/{:id}

This method is used to remove a trigger from your account. In case of successful removal the service will return an HTTP-code 204 (Successful answer).

IMPORTANT! Along with the trigger all of its alerts (current and past) will also be removed and they couldn't be restored.

URL Example

http://api.openweathermap.org/data/3.0/triggers/585268b72516b90010058184


[GET] /triggers/{:id}/history

This method is used to get a list of historical alerts which were generated by the specified trigger, but now become irrelevant.

URL Example

http://api.openweathermap.org/data/3.0/triggers/5852816a9aaacb00153134a3/history


[GET] /triggers/{:trigger_id}/history/{:alert_id}

This method is used to get information about the specific alert in the trigger's history. You need to pass the trigger's and the alert's ids to the query.

URL Example

http://api.openweathermap.org/data/3.0/triggers/58528.../history/671e2...


[DELETE] /triggers/{:trigger_id}/history/{:alert_id}

This method is used to remove a specific alert from a trigger's history. In case of successful removal service will return an HTTP-code 204 (Successful answer).

URL Example

http://api.openweathermap.org/data/3.0/triggers/58528.../history/671e2...


[DELETE] /triggers/{:id}/history

This method is used to remove all history of alerts from a trigger. In case of successful removal service will return an HTTP-code 204 (Successful answer).

URL Example

http://api.openweathermap.org/data/3.0/triggers/5852816a9aaacb00153134a3/history