Overview
Weather Report Service is web API that from one side has weather
report templates, from other side various web API data sources (e.g.
MOSI, warnings, met text, etc) as a result there is JSON data contract
with shiny XHTML or JSON report content.
Supports OAuth 2.0, Auth0.
HTTP Status Codes
This API uses HTTP status codes to communicate with the API
consumer.
- 200 OK - Response to a successful GET.
- 400 Bad Request - Malformed request; validation errors.
- 401 Unauthorized - When no or invalid authentication details are provided.
- 403 Forbidden - When authentication succeeded but authenticated user does not have access to the resource.
- 404 Not Found - When a non-existent resource is requested.
Error Responses
This API returns HTTP status code 400 Bad Request and human-readable error messages in response body when an error is encountered.
Generic Errors
Example:
{
"__ERROR__": [
"Something weird happened."
]
}
Validation ErrorsExample:
{
"template": [
"The value does not belong to the list of known items."
]
}
Reports
Retrieve HTML report
[/reports/{regionCode}?template={templateName}]
Fetch a single Weather Report [GET]
- Parameters
- regionCode: london (String, required) - report will be created for this region code
- templateName: standard (String, required) - template name
- Response 200 (application/json)
{
"metadata": {
"title": "ABC Radio London forecast script",
"issuedAt": "2012-12-14T03:15:15Z"
},
"content": "html content or json object"
}
Retrieve list of all HTML reports
[/reports]
Fetch all available HTML Weather Reports [GET]
- Response 200 (application/json)
{
"items": [
{
"title": "ABC Radio London forecast script",
"region": "london",
"link": "http://reports.weather.mg/reports/london?template=standard"
}
]
}
Retrieve JSON report
[/forecast-texts/{regionCode}]
Fetch a single JSON Forecast Report [GET]
- Parameters
- regionCode: london (String, required) - report will be created for this region code
- Response 200 (application/json)
{
"metadata": {
"title": "ABC Radio London forecast script",
"issuedAt": "2017-04-26T16:14:12Z"
},
"content": {
"headline": "Often rather cloudy, but also some brighter or sunny spells.",
"today": [
{
"title": "Today",
"forecast": "A chilly start with showers becoming rather more widespread through the morning."
},
{
"title": "Tonight",
"forecast": "Showers becoming isolated and mainly confined to western areas"
}
],
"tomorrow": [
{
"title": "Thursday",
"forecast": "Rain, some heavy, spreading eastwards, and affecting most parts then a few showers following."
}
],
"outlook": [
{
"title": "Outlook for Friday to Sunday",
"forecast": "Saturday probably dry with sunny spells. Cold northeasterly winds throughout. Chance of overnight frost."
}
]
}
}
Retrieve list of all JSON reports
[/forecast-texts]
Fetch all available JSON Forecast Reports [GET]
- Response 200 (application/json)
{
"items": [
{
"title": "ABC Radio London forecast script",
"region": "london",
"link": "http://reports.weather.mg/forecast-texts/london"
}
]
}
Guidance
Retrieve Guidance Region Codes[/guidances]
Fetch a all existed Region Codes for Guidance [GET]
- Response 200 (application/json)
[
{
"regionCode": "uk",
"title": "UK"
},
{
"regionCode": "row",
"title": "Rest Of World"
}
]
Retrieve guidance report
[/guidances/{regionCode}]
Fetch a Guidance report for region code [GET]
- Parameters
- regionCode: uk (String) - Guidance will be created for this region code
- Response 200 (application/json)
{
"metadata": {
"title": "United Kingdom guidance",
"issuedAt": "2012-12-14T03:15:15Z"
},
"content": {
"summary": "It will be a brighter day across England and Wales with sunny periods ...",
"synopticEvolutionModelDiscussion": "Low pressure will remain to the west of the UK today, with a blocking ...",
"forecast": [
{
"label": "wednesday",
"content": "Generally cloudy and mild with outbreaks..."
},
{
"label": "thursday",
"content": "Pulses of rain may spread northwards..."
},
{
"label": "friday",
"content": "A rather cloudy day, despite rising pressure..."
},
{
"label": "saturday",
"content": "Areas of mist, fog and low cloud thinning..."
},
{
"label": "sunday",
"content": "A south-westerly flow with a fair amount of cloud..."
},
{
"label": "6-10 day Outlook",
"content": "It is likely that high pressure will dominate..."
}
]
}
}
Authentication
For detailed instructions on how to obtain the necessary authorization information, please refer to the technical documentation on Bitbucket.