Real-Time Weather Insights and Forecasts
The On-Demand Events API is a powerful tool that provides real-time weather insights and forecasts for specific locations. This API allows users to retrieve valuable weather information by providing a location and a set of rules. The endpoint determines whether the specified conditions are met or not over the next 5 days (might be less, dependent on the data layer)
Tokens Usage Mechanism:
The On-Demand Events API operates on the Tomorrow.io Token System. Each request deducts tokens from the eventsTimeline product. The number of tokens deducted and the number of remaining tokens are included in the response headers with the following keys:
X-Tokens-Cost-eventsTimeline
X-Tokens-Remaining-eventsTimeline
Point location Request - 1 token.
Polygon request - 10 tokens
Example Body Requests:
Examples of a full request body in JSON format:
{
"insight":{
"rules": "(temperature > 30 AND cloudCover IS NULL)"
},
"location": {
"geometry": {
"type": "Point",
"coordinates": [
-73.890,
40.768
]
}
}
}
Insight can be provided using rules in JSON format as shown below:"
{
{ "rules": "(temperature > 30 AND cloudCover IS NULL)" }
or
You can also use conditions to specify insight in JSON format as shown below:
{"conditions": "{
"type": "OPERATOR",
"content": {
"operator": "AND"
},
"children": [{
"type": "OPERATOR",
"content": {
"operator": "EQUAL"
},
"children": [{
"type": "PARAMETER",
"content": {
"parameter": "precipitationType"
}
},
{
"type": "CONST",
"content": {
"const": 1
}
}
]
},
{
"type": "OPERATOR",
"content": {
"operator": "GREATER"
},
"children": [{
"type": "PARAMETER",
"content": {
"parameter": "precipitationIntensity"
}
},
{
"type": "CONST",
"content": {
"const": 0.5
}
}
]
}
]
}"
or InsightId:
{"insightId": "Xxxxxxxxxxxxx"}
Location Options:
"Specify the location using either geometry or locationId in JSON format:"
{
"geometry": {
"type": "Point",
"coordinates": [
-73.890,
40.768
]
}
}
or locationId:
{"locationId": "xxxxxxxxxxxxx"}
Example Use Cases:
The On-Demand Events API is a versatile tool with various use cases. It can be employed in scenarios where real-time weather insights are crucial, such as:
Weather Forecasting: Users can retrieve detailed weather forecasts for specific locations, allowing them to plan activities, events, or operations accordingly.
Environmental Monitoring: Researchers and environmentalists can leverage the API to monitor weather conditions at specific geographical points or within custom-defined polygons.
Disaster Preparedness: The API can aid emergency response teams in monitoring weather conditions in areas prone to natural disasters, helping them plan and respond proactively.
Agriculture and Farming: Farmers can use the API to receive timely weather insights, enabling better decision-making regarding planting, irrigation, and harvesting.
Notes:
On-Demand Events is currently supported only for the metric system.