Skip to content

Trip forecast (TRIAS 2020)

(TRIAS TripInfoRequest)

The trip forecast is an Open Service. It is described in VDV 431 TripInfoRequest.

Technical description

In order to use the trip forecast a JourneyRef must be known. Unfortunately, this cannot be simply derived from the timetable (timetables available via the Timetable overview). The simplest way to generate the JourneyRef is by querying one of the other APIs (TripRequest or the arrival and departure display).

Key concepts

  • Stops: Use DiDok or stop datasets from other sources.
  • Journeys: A journey involves transporting customers along a particular route, according to a particular timetable connection, by a particular means of transport, at a particular time, in a particular direction.
  • Timetable: A timetable determines the progress of a means of transport in public short- and long-distance passenger traffic and in railway freight traffic. The information required for this includes train numbers, days of operation, routes, arrival, departure and passing times at the stops, as well as permissible speeds in individual sections of the route.
  • Forecasts: Forecasts concern a train’s running times in the future, which are calculated based on the train’s current location. This also takes into account conflicts and their currently intended settlements in the next x minutes. A less elaborate method is used to calculate future values of the forecast.
  • Means of transport (VM): Either used synonymously with vehicles (train, boat, tram, bus) from different carriers or in the sense of a “transport system” (public transport etc.).
  • DateTime in Response: It is always based on Zulu time (i.e. UTC). That means, you have to add two hours in summer and one hour in winter.

Technical aspects

API Explorer

Authorisation and Open Services

An API keyword is required to access this API. It can be obtained via the Developer Portal. The token must also be sent in the HTTP header as “Authorization”.

Access URL

API: https://api.opentransportdata.swiss/trias2020

Test-Key: 57c5dbbbf1fe4d000100001842c323fa9ff44fbba0b9b925f0c052d1

With the Authorization header and Content type= “text/XML” or “application/XML”

Authorization header

Sample request

<? xml version="1.0" encoding="utf-8"?>
<Trias version = "1.1" xmlns="http://www.vdv.de/trias" xmlns:siri="http://www.siri.org.uk/siri" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ServiceRequest>
        <siri:RequestTimestamp>2020-09-30T19:53:23.659Z</siri:RequestTimestamp>
        <siri:RequestorRef>API-Explorer</siri:RequestorRef>
        <RequestPayload>
            <TripInfoRequest>
                <JourneyRef>odp:80045:Y:H:j17:3928</JourneyRef>
                <OperatingDayRef>2020-09-30</OperatingDayRef>
                <Params>
                    <IncludeCalls>true</IncludeCalls>
                    <IncludeService>true</IncludeService>
                </Params>
            </TripInfoRequest>
        </RequestPayload>
    </ServiceRequest>
</Trias>

The request is transferred as body.

Explanatory notes on the elements of the request

Relevant elements in the request:

Name Mandatory? Description Example
JourneyRef Yes(*) The JourneyRef must be generated or obtained from another source. odp:01012::H:j16:30441
OperatingDayRef No Day of operation. If no day of operation is specified, the current day of operation is used 2020-04-02T
Params No Further parameters … see table below

(*) VDV 431 features requests regarding VehicleRef and TimeOfOperation. They should not be used, TRIAS  does not use VehicleRef.

Params – further parameters:

Name Mandatory? Description Example
UseTimetabledDataOnly No Determines whether information about days of operation is to be output in the result. Boolean. Default is false. false
IncludeCalls No Determines whether the stops in the journey are to be output in the result. Boolean. Default is true.

This parameter is ignored. The system always uses true.

IncludePosition No Determines whether the current position of the means of transport is to be output in the result. Boolean. Default is true.

This parameter is ignored. The system always uses true.

IncludeService No Determines whether transport information about the journey is to be output in the result. Default is true. true
Extension No No extensions implemented

 

Explaining a response

The response has the following basic structure:

<? xml version="1.0" encoding="UTF-8"?>
<trias:Trias xmlns:siri="http://www.siri.org.uk/siri" xmlns:trias="http://www.vdv.de/trias" xmlns:acsb="http://www.ifopt.org.uk/acsb" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:datex2="http://datex2.eu/schema/1_0/1_0" version="1.1">
    <trias:ServiceDelivery>
        <siri:ResponseTimestamp>2020-09-30T20:25:44Z</siri:ResponseTimestamp>
        <siri:ProducerRef>EFAController10.4.10.25-OJP-EFA01-P</siri:ProducerRef>
        <siri:Status>true</siri:Status>
        <trias:Language>de</trias:Language>
        <trias:CalcTime>18</trias:CalcTime>
        <trias:DeliveryPayload>
            <trias:TripInfoResponse>
                <trias:TripInfoResult>
                    <trias:OnwardCall>
                        <trias:StopPointRef>8507000</trias:StopPointRef>
                        <trias:StopPointName>
                            <trias:Text>Bern</trias:Text>
                            <trias:Language>de</trias:Language>
                        </trias:StopPointName>
                        <trias:ServiceDeparture>
                            <trias:TimetabledTime>2020-10-14T07:22:00Z</trias:TimetabledTime>
                            <trias:EstimatedTime>2020-10-14T07:22:00Z</trias:EstimatedTime>
                        </trias:ServiceDeparture>
                        <trias:StopSeqNumber>1</trias:StopSeqNumber>
                    </trias:OnwardCall>
                    <!-- weitere Calls -->
                    <trias:Service>
                        <trias:OperatingDayRef>2020-10-14</trias:OperatingDayRef>
                        <trias:JourneyRef>ojp:91008:E:H:j20:17:8093</trias:JourneyRef>
                        <trias:LineRef>ojp:91008:E:H</trias:LineRef>
                        <trias:DirectionRef>outward</trias:DirectionRef>
                        <trias:Mode>
                            <trias:PtMode>rail</trias:PtMode>
                            <trias:RailSubmode>local</trias:RailSubmode>
                            <trias:Name>
                                <trias:Text>S 8093</trias:Text>
                                <trias:Language>de</trias:Language>
                            </trias:Name>
                        </trias:Mode>
                        <trias:PublishedLineName>
                            <trias:Text>8</trias:Text>
                            <trias:Language>de</trias:Language>
                        </trias:PublishedLineName>
                        <trias:OperatorRef>ojp:88</trias:OperatorRef>
                        <trias:OriginStopPointRef>8507000</trias:OriginStopPointRef>
                        <trias:OriginText>
                            <trias:Text>Bern</trias:Text>
                            <trias:Language>de</trias:Language>
                        </trias:OriginText>
                        <trias:DestinationStopPointRef>8508059</trias:DestinationStopPointRef>
                        <trias:DestinationText>
                            <trias:Text>Solothurn</trias:Text>
                            <trias:Language>de</trias:Language>
                        </trias:DestinationText>
                    </trias:Service>
                </trias:TripInfoResult>
            </trias:TripInfoResponse>
        </trias:DeliveryPayload>
    </trias:ServiceDelivery>
</trias:Trias>

 

The key elements of the response can be found in TripInfoResultStructure:

Name Mandatory? Description Example
PreviousCall No/multiple Stops already served. Also includes the current stop if the journey is exactly at a stop. Structure of its own … see table below
CurrentPosition No Current position of the vehicle

Is not implemented.

OnwardCall No/multiple The stops still ahead in the journey Structure of its own … see table below
Service No Traffic details Structure of its own … see further below
OperatingDays No Days of operation for this route

Not implemented

OperatingDaysDescription No Machine-readable description of days of operation, e.g. “Monday to Friday” or “Sunday and public holidays”.

Not implemented

 

PreviousCall and OnwardCall have the following structure:

Name Mandatory? Description Example
StopPointRef  Yes  Reference to a code for a stop. 857000
StopPointName  Yes Name of the stop for passenger information.

NB: Language is always DE.

<trias:StopPointName>
  <trias:Text>Eiken<trias:/Text>
  <trias:Language>DE</trias:Language>
</trias:StopPointName>

 

PlannedBay No Name of the platform/stop where passengers must board or alight from the vehicle (when used along with specific route information; if a general name is specified in StopPointName, it is similar to the stop name). According to plan status.
<trias:PlannedBay>
  <trias:Text>43/44</trias:Text>
  <trias:Language>DE</trias:Language>
</trias:PlannedBay>
EstimatedBay No Name of the platform/stop where passengers must board or alight from the vehicle (when used along with specific route information; if a general name is specified in StopPointName, it is similar to the stop name). According to last forecast.
<trias:EstimatedBay>
  <trias:Text>43</trias:Text>
  <trias:Language>DE</trias:Language>
</trias:EstimatedBay>

 

ServiceArrival  No  Arrival times
<trias:ServiceArrival>
  <trias:TimetabledTime>2020-04-02T11:56:00Z</trias:TimetabledTime>
</trias:ServiceArrival>

 

TimetabledTime Yes Timetabled arrival time

Always in Zulu time

2020-04-02T11:20:00Z
RecordedAtTime No Actual arrival time

Is not used

EstimatedTime No Estimated arrival time

Only if real-time data is available

In the case of sections of the journey in the past, the last forecast or actual data applies.

Currently, actual data are deleted just after departure.

2020-04-02T11:20:00Z
ServiceDeparture  No  Departure time Analogous to SeviceArrival
StopSequenceNumber Yes  Sequence number of stop 4
DemandStop No Stop on request only. The vehicle only services this stop if asked in advance. Boolean Not available
UnplannedStop No Stop not foreseen by the timetable. Boolean
<trias:UnplannedStop>true</trias:UnplannedStop>
NotServicedStop No Cancelled stops
<trias:NotServicedStop>true</trias:NotServicedStop>
SituationFullRef No, multiple Reference to a failure message. This message can be found in the response’s ResponseContext be retrieved in another way. Not available

Service

The “Service” structure is described here: Service (VDV 431)

Errors/Problems

The response will contain an “ErrorMessage” if there were problems executing the request:

<? xml version="1.0" encoding="UTF-8"?>
<trias:Trias xmlns:siri="http://www.siri.org.uk/siri" xmlns:trias="http://www.vdv.de/trias" xmlns:acsb="http://www.ifopt.org.uk/acsb" xmlns:ifopt="http://www.ifopt.org.uk/ifopt" xmlns:datex2="http://datex2.eu/schema/1_0/1_0" version="1.1">
    <trias:ServiceDelivery>
        <siri:ResponseTimestamp>2020-09-30T20:01:37Z</siri:ResponseTimestamp>
        <siri:ProducerRef>EFAController10.4.10.25-OJP-EFA01-P</siri:ProducerRef>
        <siri:Status>true</siri:Status>
        <trias:Language>de</trias:Language>
        <trias:CalcTime>15</trias:CalcTime>
        <trias:DeliveryPayload>
            <trias:TripInfoResponse>
                <trias:ErrorMessage>
                    <trias:Code>-1</trias:Code>
                    <trias:Text>
                        <trias:Text>TRIPINFO_NOJOURNEYFOUND</trias:Text>
                        <trias:Language>de</trias:Language>
                    </trias:Text>
                </trias:ErrorMessage>
            </trias:TripInfoResponse>
        </trias:DeliveryPayload>
    </trias:ServiceDelivery>
</trias:Trias>

Comments

IMPORTANT: External developers should be aware of the following points:

Further information