TW TRO API

API Reference

This API will return any restrictions around a predefined radius, if not specified, from the given coordinates or all the restrictions of a specified area

BASE URL
                https://api.trafficorders.uk/tro/v1/...
              

Errors

The TRO API uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, etc.). Codes in the 5xx range indicate an error with BC's servers (these are rare).

Some 4xx errors that could be handled programmatically include an error code that briefly explains the error reported.

HTTP status code summary
200 - OK Everything worked as expected.
400 - Bad Request The request was unacceptable, often due to missing a required parameter.
404 - Not Found The requested resource doesn't exist.
405 - Method Not Allowed the request method is known by the server but is not supported by the target resource.
500 - Server Errors Something went wrong on the API end. (These are rare.)

Methods

The TRO API at the moment works just with the GET method.

Methods
GET  /tro/v1/...

Endpoints

The TRO API uses differents endpoints to return different type of data

Endpoints
GET  /tro/v1/bcnative/
GET  /tro/v1/bcnative/order/
GET  /tro/v1/apds/
GET  /tro/v1/apds/places/
GET  /tro/v1/apds/rights/
GET  /tro/v1/apds/rates/
GET  /tro/v1/trod/

Parameters

The TRO API needs some parameter to return data, some are optional and some are mandatory.

The EPSG parameter is optional, the default value is EPSG:27700, the supported projection are EPSG:3857, EPSG:4326 and EPSG:27700.

The X and Y parameters are mandatory if the area is not specified.

The Area parameter is mandatory if the X and Y are not specified.

The Radius parameter is optional, if not specified will return all the data in a 50 meters radius. If the Area is specified this parameter will be ignored.

The Order and OrderID parameters are optionals, if not specified it will return informations about all the restrictions.

Parameters
EPSG epsg=27700
X x=383666.200
Y y=398197.500
Area area=Manchester
Radius radius=200
Order order={order reference}
OrderID orderid={order ID}

BCNative Output

When you are using the BCNATIVE output format you can use the following endpoints:

  • bcnative
  • bcnative/order

The bcnative endpoint, returns all restrictions around a specified point or in an area and it works with the following parameters:

  • epsg
  • x
  • y
  • radius
  • area
  • order

The bcnative/order endpoint return all the informations about an order and needs the following parameters:

  • area
  • order
/tro/v1/bcnative/
                /bcnative/{order/}?x=...&y=...
              
Response
              {
  "type": "Feature",
  "ID": 14712,
  "Version": 1,
  "LegalOrder": {
    "Order_Reference": "C1573",
    "OrderTitle": {
      "Title": "CITY OF MANCHESTER..."
    },
    "OrderValidity": {
      "OrderStartDate": "2000-07-23",
      "OrderEndDate": "2199-01-01"
    }
  },
  "LocationDescription": {
    "Street": "Oldham Street",
  ...
  },
  "Restriction": {
    "APIGroupEnum": "prohibitionOfDriving",
    "OrderType": "Prohibition of Driving",
    "Schedule": {
      "ID": "17.35",
      "Description": "Prohibition of Driving..."
    },
    "Validity": {
      "ValidPeriod": [
        {
          "PeriodName": {
            "en": "Monday to Sunday ID359"
          },
          "RecurringTimePeriodOfDay": [
            {
              "startTimeOfPeriod": "10:00",
              "endTimeOfPeriod": "16:00"
            }
          ],
          "RecurringDayWeekMonthPeriod": {
            "applicableDay": [
              "monday",
              "tuesday",
              "wednesday",
              "thursday",
              "friday",
              "saturday",
              "sunday"
            ]
          }
        },
    ...
      ]
    },
    "Supply": {
      "Spaces": ...
    },
    "style": {
  ...
    }
  },
  "Geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          384451.0432,
          398455.3425
        ],
    ...
  ]
    ]
  }
}
              
            

APDS Output

When you are using the APDS output format you can use the following endpoints:

  • apds
  • apds/places
  • apds/rights
  • apds/rates

The apds and apds/{places/} endpoints works with the following parameters:

  • epsg
  • x
  • y
  • radius
  • area

The apds/{rights/} endpoint works with the following parameters:

  • epsg
  • x
  • y
  • radius
  • area
  • orderid

The apds/rates endpoint works with the following parameter:

  • orderid (in this case it refers to the rates ID)
/tro/v1/apds/
                apds/{places/}{rights/}{rates/}?x=...&y=...
              
Response
            [
    {
      "id": "Campus_1",
      "name": {
        "en": "Manchester"
      },
      "description": {
        "en": "The city of Manchester"
      },
      "layer": 0,
      "type": "campus",
      "version": 1,
      "timeZone": "Europe/London",
      "indicativePointLocation": {
        "type": "Point",
        "coordinates": [
          53.483959,
          -2.244644
        ]
      },
      "children": [
        "id": "Place_ChanceryPlace_manchester",
        "name": {
          "en": "Chancery Place"
        },
        "description": {
          "en": "Chancery Place"
        },
        ...
      ],
      ...
              
              

TRO-D Output

When you are using the TROD output format you can use the following endpoints:

  • trod
  • trod/order

The trod endpoint works with the following parameters:

  • epsg
  • x
  • y
  • radius
  • area
  • order

The trod/order endpoint returns all information about an order and needs the following parameters:

  • area
  • orderid
/tro/v1/trod/
                ?x=...&output=trod
              
Response
            {
  "geometry": {
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "id": 10772,
        "properties": {
          "type": "No Loading at Any Time",
          "operating_restriction": "No Loading At Any Time",
          "street_name": "MULBERRY STREET (westernmost carriageway)"
        },
        "geometry": {
          "type": "LineString",
          "coordinates": [
            [
              -2.24786637844713,
              53.4799893808932
            ],
            [
              -2.24786764282246,
              53.4799931523412
            ],
            [
              -2.24781729170659,
              53.480093629234
            ],
            [
              -2.24783135238095,
              53.4800973741203
            ],
            [
              -2.24778350360025,
              53.4802009010044
            ]
          ]
        }
      },
      {
        next feature...
      }
    ]
  }
}
              
              

Request Builder

The TROAPI request builder provides a graphical interface which generates the template request depending on the options selected.

/tro/v1/{format}
                ?Name=Value&Name2=Value2...