Get Started

Departure Boards for Individual Stops

A common use of the Entur APIs is to show the next departures from a certain stop place. You can use this to create you own departure board similar to that on entur.no, Tavla or on the different bus stop displays around town. We'll show you how with some simple examples.

Goal: display the next 5 train departures from Oslo S (the Oslo Central Station).

First of all, we need to find the Stop Place ID for Oslo S. We can use the search field on the Geocoder page to look it up. We search for "Oslo S" and find the ID "NSR:StopPlace:59872". Great!

Now, let's use the Journey Planner API to find us some departures.

The following diagram illustrates trip search in the Entur application. Initially, the user searches for stop places from the Geocoder API before the full trip search with given parameters (start point, destination, date, trip alternatives, etc.) is started.

The travel search is done through the Offers API's /search/graphql endpoint. This endpoint works just like the JourneyPlanner API, but Offers handles the response like so:

  • Stores the resulting trip patterns in a database for about 20 min
  • Puts a unique id on each of the trip patterns
  • Starts fetching pricing data for 1 adult for each of these trip patterns

When the client has received the trip patterns, it can request offers (prices) for each of these by their ID using the /search/trip/trip-pattern/{id} endpoints.

For each travel option products are fetched with a rest-request from Backend for Frontend. The answers are streamed to the client.

Geocoder

Trip search
Offers

Sale

The following diagram illustrates a sale in the Entur application. When the trip search flow is completed, a sale may begin. The user must be logged in to purchase an offer because the endpoints in this flow demand authentication. Notice that each service demands several requests. The requests are listed in the diagram below.

The diagram illustrates the process given that the travel search is completed and that the client wishes to purchase an offer based on offerId and offerConfigurations.

Sales
Sales

Create order

Sales

Pay order

Sales

Distribute ticket

Sales
Sales
NOD


Create an order in three steps:

  1. Create an empty order
  2. Get the order
  3. Add an offer to the order by sending offerId and offerConfigurations

A sale comprises several steps:

  1. Create Payment
  2. Create a Payment Transaction
  3. Open NETS-terminal (Optionally: use a saved card)
  4. Complete payment

A ticket is created in two steps:

  1. Create ticket
  2. Distribute ticket to National Order Database (NOD)