Skip to content

Beta: Price information with OJP Fares

A query of public transport prices via NOVA is made available via this interface.

This is an initial test system and the data comes from integration and not from production.

(Timetable)

Technical description

The OJP fare service allows you to calculate the price of trips. The service can be used to carry out queries in OJP format against the NOVA. The answers also include discount trips. The enquiry must be made in the future. The journeys must be entered as TripResult.

Price enquiries are only possible in Switzerland. Price enquiries with Half Fare Travelcard (“HTA”) are possible.

The price information is not binding. The actual price is not defined until the order is placed.

The number of requests is also limited.

Technical aspects

At the moment, only the integration system is available.

URL: https://api.opentransportdata.swiss/ojpfare/

Access is only possible using the API key. See: Developer Dashboard | Open Data Platform Mobility Switzerland (opentransportdata.swiss)

The service also allows you to send OJPTripRequests and then obtain the necessary TripResults for the query.

Example: OJPTripRequest within Bern

 

 

A TripResult in the answer:

 

The effective OJPFareRequest then looks like this (where we only show the position of the trip and do not fill it in):

 

Parameter

Trips are explained in OJPTripRequest. Therefore, the parameters are primarily discussed here

Parameter Explanation Example
oFareAuthorityfilter Currently set to NOVA. Is ignored in the service. ojp:FareAuthorityFilter>ch:1:NOVA</ojp:FareAuthorityFilter>
PassengerCategory PassengerCategory selection list. Ignored at the moment. <ojp:PassengerCategory>Adult</ojp:PassengerCategory>
Traveller More information about the traveller. Ignored at the moment.
Age The age of the traveller. Ignored at the moment.
EntitlementProduct At the moment, only the EntitlementProductRef HTA (half-price subscription) is supported.
If this is set, half-fare prices are shown, otherwise the full price.
The result then looks like this.request then looks like this (where we only show the position of the trip and do not fill it in):

Important points

  • The price calculation only works for the future.
  • Only public transport legs can be evaluated.
  • The price information also includes supersaver tickets, if they exist. Normal price tickets have the code 125. For example, BLS uses the product code 84004 for Bern – Zweisimmen.
  • If On Demand, Sharing etc. is listed on the trip, the behaviour is not fully defined at the moment. As a matter of principle, we are informed that not all legs could be priced.
  • The half-price calculation was fixed until now. This is different now. A corresponding traveller with the EntitalementProduct is now required.

 

Known problems

  • At the moment, the data is obtained from the NOVA integration environment.
  • The error messages are not optimal.
  • At the moment, the half-fare price (HTA as EntitlementProduct) is permanently coded into the service. We are considering cancelling this. However, the EntitlementProduct must then be inserted. The age is adopted. But the price is also otherwise set to “Person”.
  • In certain cases, a change is made to a day pass. For example, because there is no first-class ticket. Then you may be able to get a discounted day ticket under code 2361. This must be filtered.
  • No prices are shown for stops abroad (e.g. not even Léman Express)

Further information