Developer information
Congratulations! Your WxAdvisory account comes with a fully equipped developer API. With this interface, you can query questions or locations and retrieve the forecasts in XML format.
WxAdvisory has an extremely simple method of obtaining weather data, with XML weather feeds being available for any location or question.
Weather data can be directly inserted into existing communication channels, such as Twitter, Facebook, email and SMS.
If you're a business, you can provide weather notifications to your users with minimal impact on their daily activities.
You can retrieve either complete forecasts with hourly breakdowns of all the various weather components, or ask it a direct question and get a straight forward answer.
What method you should use will probably depend on what you're trying to achieve.
Introduction
First of all, you'll need to know what your API key is. This is your access key to all the XML interfaces.
You'll need to either create an account or log in to see your API key.
Now you can select the best way to retrieve weather forecasts.
Forecast interface (method #1)
This the traditional approach, where you get the complete forecast split into its various components. You can then choose the bits you want and compose your own result. This method also includes the text descriptions of the various timespans, so you don't have to construct text descriptions if you don't want to.
Question interface (method #2)
If you want to embed a weather forecast about a specific time and place, then the question method is probably the best. By asking about a specific time, place and weather condition, you can get a direct answer that doesn't require any processing.
Method 1: How to request a forecast
You can access all the weather forecast information in XML format via special HTTP requests.
As an example, if you wanted the week-long forecast for London, the standard URL is this:
https://wxadvisory.com/forecast/week/London
To retrieve the same forecast in XML format, you would use this URL:
https://wxadvisory.com/forecast/week/London/XML/abcde12345
An XML request is made up the following components:
https://wxadvisory.com/forecast/[date]/[location name][lat,lon]/xml/[API Key]
[date]
This can be either the value 'week', 'today', 'tomorrow', any one of the 7 days of the week (monday-sunday), a valid date within the supported forecast range, or a day offset such as day1, day2, etc.
If you provide a date, it's recommended that you use the format d-mmm-y (10-Dec-2024) to avoid confusion. Day offsets are always relative to the current day, so 'day1' is today, 'day 2' is tomorrow and so on.
If your date can't be resolved, it will default to the first day of the week-long forecast
Examples:
- https://wxadvisory.com/forecast/week/London/xml/abcde12345
- https://wxadvisory.com/forecast/today/London/xml/abcde12345
- https://wxadvisory.com/forecast/tomorrow/London/xml/abcde12345
- https://wxadvisory.com/forecast/tuesday/London/xml/abcde12345
- https://wxadvisory.com/forecast/day1/London/xml/abcde12345
- https://wxadvisory.com/forecast/day7/London/xml/abcde12345
- https://wxadvisory.com/forecast/10-Dec-2024/London/xml/abcde12345
[location name][lat,lon]
This is the name and coordinates of the location you want a forecast for.
If you do not know the lat/lon coordinates, you can just provide the location name, and WxAdvisory will automatically look it up.
It is highly recommended that you provide the lat/lon coordinates - if you know them - because some location names may be ambiguous or cannot be resolved.
If you provide the location name and the coordinates, WxAdvisory will use the lat/lon coordinates for the forecast, and use the location name in the results, regardless of what the lat/lon coordinates actually resolve to.
You can also provide just the coordinates, and WxAdvisory will automatically complete the name for this location.
Examples:
- https://wxadvisory.com/forecast/week/London/xml/abcde12345
- https://wxadvisory.com/forecast/week/London,51.5072759,-0.1276597/xml/abcde12345
- https://wxadvisory.com/forecast/week/51.5072759,-0.1276597/xml/abcde12345
[API Key]
This is your API key.
If your API key is incorrect, or has exceeded the usage limits, you will get an error message.
Method 2: How to ask a question
The question interface works in the same manner as the forecast interface, and looks like this:
https://wxadvisory.com/question/[question]/[location name][lat,lon]/xml/[API Key]
[question]
This can be any natural-language question. To get an idea of the scope of what's possible, please refer to the FAQ.
If the question contains a location name (or is judged to have a location), then this will be used as the coordinates of the forecast if no futher location information is provided.
When creating the XML request, make sure that your question is properly URL-encoded, including all spaces and punctuation.
[location name][lat,lon]
The location section of the request works in the fashion as the forecast method.
This is the name and coordinates of the location you want to ask a question about.
If you do not know the lat/lon coordinates, you can just provide the location name, and WxAdvisory will automatically look it up.
It is highly recommended that you provide the lat/lon coordinates - if you know them - because some location names may be ambiguous or cannot be resolved.
If you provide the location name and the coordinates, WxAdvisory will use the lat/lon coordinates for the forecast, and use the location name in the results, regardless of what the lat/lon coordinates actually resolve to.
When creating the XML request, make sure that your location name is properly URL-encoded, including all spaces and punctuation.
If a question contains a location name, the provided location coordinates will override this.
You can also provide just the coordinates, and WxAdvisory will automatically complete the name for this location.
You can leave the location value empty and provide the word 'false', but you will need to include a location in the question in order to receive a result.
Examples:
- https://wxadvisory.com/question/Will%20it%20rain%20tomorrow%3F/xml/abcde12345
- https://wxadvisory.com/question/How%20hot%20will%20it%20be%20in%20Sydney%20on%20Sunday/sydney,-33.8548157,151.2164539/xml/abcde12345
- https://wxadvisory.com/question/What%20is%20the%20forecast%20for%20London%20at%20midday%20on%20Friday%3F/london,51.5072759,-0.1276597/xml/abcde12345
- https://wxadvisory.com/question/Will%20there%20be%20a%20southerly%20tomorrow%20in%20Wellington%3F/false/xml/abcde12345