Endpoint: Service Details

The following API Endpoint allows you to get information for specific train services. There is 1 endpoint available here:


Endpoint Description
getServiceDetailsByID Shows the next departing service between two stations

Get Service Details by ID

getServiceDetailsByID is used to get information on a service, by the Service ID. This will typically return a train service, but will also return a bus and ferry services.

The Service ID must be provided in the serviceIDUrlSafe format that is provided in the response for Arrival and Departure Boards. If required, these can be manually converted replacing:

  • = with -
  • / with _
  • + with !

For example, a National Rail Service ID of qsec4O8LW7k8ITcOt/ir4Q== becomes qsec4O8LW7k8ITcOt_ir4Q--. However, you should be using the value provided in the Arrival and Departure Board responses.

A service ID is specific to a station, and can only be looked up for a short time after a train/bus/ferry arrives at, or departs from a station. This is a National Rail limitation.


HTTP Request

GET https://api.departureboard.io/api/v2.0/getServiceDetailsByID/{serviceID}/


URL Parameters

Parameter Default Description
serviceID
required
none The Service ID for the Train Service you wish to look up in the URL Safe format. For example, qsec4O8LW7k8ITcOt_ir4Q--.

Query Parameters

Parameter Default Description
apiKey
required
none The National Rail OpenLDBWS API Key to use for looking up service information. You must register with National Rail to obtain this key and whitelist it with us.

Example Queries

Lookup a service with the ID qsec4O8LW7k8ITcOt_ir4Q--:

curl -X GET "http://api.departureboard.io/api/v2.0/getServiceDetailsByID/0gN6ZPyTiOC1WfjQv7iNKQ--/?apiKey=1234"


Example Response

curl -X GET "https://api.departureboard.io/api/v2.0/getServiceDetailsByID/ERZbOJ8wYnOnNgNyaa1Xaw--/?apiKey=1234"

Expand Response
{
"GeneratedAt": "2019-09-10T13:57:42.8199973+01:00",
"nationalRailResponseTimeMilliseconds": 91,
"serviceID": "h+eimq/ol4h/pG9h8Ut8eg==",
"serviceIDUrlSafe": "h!eimq_ol4h_pG9h8Ut8eg--",
"locationName": "London Paddington",
"serviceType": "train",
"isCancelled": null,
"cancelReason": null,
"delayReason": null,
"overdueMessage": null,
"adhocAlert": null,
"sta": null,
"eta": null,
"ata": null,
"std": "13:50",
"etd": null,
"atd": "On time",
"length": null,
"detachFront": null,
"isReverseFormation": null,
"platform": null,
"operator": "Great Western Railway",
"operatorCode": "GW",
"rsid": null,
"subsequentCallingPointsList": [
  {
    "subsequentCallingPoints": [
      {
        "locationName": "Slough",
        "crs": "SLO",
        "st": "14:05",
        "et": "On time",
        "at": null,
        "length": null
      },
      {
        "locationName": "Oxford",
        "crs": "OXF",
        "st": "14:48",
        "et": "On time",
        "at": null,
        "length": null
      }
    ]
  }
],
"previousCallingPointsList": null
}

Notes

It is possible to have two sets of previousCallingPoints or subsequentCallingPoints returned for a service (when looking up train services that split). Consequently, previousCallingPoints and subsequentCallingPoints are returned in the previousCallingPointsList and subsequentCallingPointsList arrays.

However, in 99% of circumstances there are only 1 set of previousCallingPoints and subsequentCallingPoints returned. For services that do not split, you can use previousCallingPointsList[0].previousCallingPoints or subsequentCallingPointsList[0].subsequentCallingPoints to access the calling points. The Python Code Samples have examples of how this works.