The WebTRIS data available at
http://webtris.nationalhighways.co.uk/ is available via an application programming interface (API) in JSON format.
This is a free service and there is no need to register to use it.
Developers can utilise the WebTRIS data to provide their own services, applications and websites.
All WebTRIS API endpoints are available without registration or API keys and as such no login details are required.
The current version of the WebTRIS API is 1.0. As indicated, this is the first release and currently all WebTRIS data accessible through
http://webtris.nationalhighways.co.uk/
is available through the API. Feedback is encouraged and can be provided via the forums (coming soon). Future API versions seek to accommodate functionality requested.
Although there is currently only one version of the API (v1.0) the intention for future versions is that National Highways will maintain at least one previous depreciated version
of the api to allow developers to migrate their code. It is advisable to move to the latest version of the API (v1.0)
The API is located at http://webtris.nationalhighways.co.uk/api/{version}/{resource} where {version} is the version of the API (currently v1.0) and {resource} is the API
resource requested. For example, http://webtris.nationalhighways.co.uk/api/v1.0/sites will return JSON for all sites. A complete list of available endpoints with examples follows:
All endpoints are prefixed with the API url http://webtris.nationalhighways.co.uk/api/v1.0/
Resource | Endpoint | Description |
Sites | /sites | Provides details of all sites. |
Sites | /sites/1 | Provides details of the site specified |
Reports | /reports/monthly?sites=8188&start_date=31032016&end_date=31032017&page=1&page_size=50 | Provides Monthly report details of the site specified |
Reports | /reports/daily?sites=8188&start_date=31032016&end_date=31032017&page=1&page_size=50 | Provides details of the site specified |
Reports | /reports/31032016/to/31032017/daily?sites=8188&page=1&page_size=50 | Alternative routing for the above endpoint. |
Areas | /areas/ | Provides details of all areas. |
Areas | /areas/1 | Provides details of the area specified |
Site Types | /sitetypes/ | Provides details of all site types |
Site Types | /sitetypes/1/sites | Provides details of the site type specified |
Data Quality | /quality/daily?siteid=8188&start_date=01012015&end_date=01042016 | Provides a quality percentage of the site and date range specified |
Data Quality | /quality/overall?sites=8188,1976&start_date=01012015&end_date=01042016 | Provides an overall quality percentage of the sites and date range specified |
Note that the reports resource requires paging parameters as part of the query due to the large collections results returned.
The easiest way to get up and running with the API is to try out the end points following the Swagger documentation below.