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.
Trip Search
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.
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.
Create order
Pay order
Distribute ticket
Create an order in three steps:
- Create an empty order
- Get the order
- Add an offer to the order by sending offerId and offerConfigurations
A sale comprises several steps:
- Create Payment
- Create a Payment Transaction
- Open NETS-terminal (Optionally: use a saved card)
- Complete payment
A ticket is created in two steps:
- Create ticket
- Distribute ticket to National Order Database (NOD)