The API allows accessing these concepts as hierarchy of objects (see later) as well as performing searches.

Journeys API combines together various data sources and offers their contents to developers and clients via JSON requests made over HTTP. Static data (ie. lines, routes, stops and time schedules) comes from GTFS (https://developers.google.com/transit/gtfs/) files. This data is augmented with proprietary MALA format (tariff zones, municipalities). Real-time data (observations on where public transport vehicles are currently operating) are polled from siri.ij2010.tampere.fi SIRI VM endpoint once in a second. This data includes for example real-time coordinate updates for public transport vehicles. API Entities

The API is built on top of NeTEx entity model (http://user47094.vs.easily.co.uk/netex/), from which the entities in this API are derived. Following picture outlines the entities and their relationships. In the picture above, entities are drawn with purple color. Boxes with blue color are properties of the entities, but drawn out to explain the concepts. Lines in the picture represent UML-styled relations. Diamond (either filled or empty) indicates ownership, in other words: the entity which has a diamond attached to it is considered a parent and owns the entity at the other end of the line, which is considered a child. Lines with filled diamond represent composite relationship indicating that the child cannot exist without its parent, empty diamond indicates aggregate relationship where the child can exist without the parent. Numbers at the end of lines are multiplicity rules, which tell how many entities or properties are included in the relation. If number is not present at the end of a line, it is assumed that number one would exist at the end of that line. For example: a JOURNEY PATTERN cannot exist without a ROUTE (and ROUTE owns the JOURNEY PATTERN), but a STOP POINT can exist without JOURNEY PATTERN although JOURNEY PATTERN owns the STOP POINT. A ROUTE can own multiple JOURNEY PATTERNs, however each JOURNEY PATTERN must be owned by single ROUTE. JOURNEY PATTERN on the other hand can have two or more STOP POINTS (at minimum the start and stop points of the pattern), and one STOP POINT can be present on many JOURNEY PATTERNS.

ROUTE entity describes a path through (a road or a rail) network, which is used by a public transport service (such as bus or a tram). ROUTE has typically one or more projections. Projection is a way to describe a ROUTE on selected canvas. For example a route could be presented on a map by drawing it as a line on it. Another way would be project a ROUTE for example to OpenStreetMap by using OpenStreetMap roads to present the ROUTE. Journeys API currently supports only projecting the ROUTE as coordinate shape. Following picture is taken from Tampere "reittikartta" and outlines a ROUTE through Tampere. LINE entity is a grouping of ROUTES that is generally known to the public with a common name, such as "Line 2". ROUTES on the same LINE usually follow similar ROUTEs.

Journey, Journey Pattern, DayType, DayTypeException and StopPoint

JOURNEY describes public transport vehicle's run on a given ROUTE through the city. Typically the run occurs at the same time on multiple days during a week. For example a certain JOURNEY on given ROUTE could start 10:00 AM on Mondays, Tuesdays, Wednesdays, Thursdays and Fridays. DAY TYPE, attached to a JOURNEY, classifies the conditions on which kind of days the JOURNEY occurs. Conditions can be week day names, but other kind of conditions can apply too (such as "busy day" or "all weekdays"). DAY TYPE EXCEPTION provides mechanism to temporarily deviate from conditions imposed by a DAY TYPE. For example if a JOURNEY would occur on all weekdays, public holidays could be modeled as DAY TYPE EXCEPTIONS. In other words we could say "This JOURNEY runs on every week day except 21.5.2014, because that day is Labor Day".

On a given time on a given DAY TYPE or a given ROUTE, the JOURNEY stops on certain STOP POINTS from where passengers can board or alight the vehicle. A CALL groups together the STOP POINT where the vehicle stops, and the time when the vehicle stops on that STOP POINT. Since the vehicle stops multiple times during a JOURNEY, a CALL also contains the order of the stop. CALLs on a certain JOURNEY follow a JOURNEY PATTERN. JOURNEY PATTERN is in essence a ordered sequence of STOP POINTS on which the JOURNEY stops. In other words: ROUTE describes the vehicle's path through road network, and a JOURNEY PATTERN "overlays" it with a sequence of STOP POINTs. Consider a ROUTE as continuous drawn line and STOP POINTs as drawn circles on top of the line. STOP POINTs must follow the drawn line since those have to be on the vehicle's route. Single ROUTE can, however, have multiple JOURNEY PATTERNs: for example one for express line (which skips some of the stops) and one for the normal line which stops on every STOP POINT.

Queries and Responses

REST styled API

Journeys API follows RESTful design pattern. This means that all entities returned by the API have an unique URL via which the entity can be accessed at all times. The returned entities refer to each other via these URLs, and each entity URL is always included in the entity itself as "href" property. Following is a fragment from STOP POINT entity response:

The STOP POINT itself has a url property which points to the STOP POINT entity itself. A client can use this URL access this entity at any time. Nested objects may also include urls as in case of muncipality inside the stopPoint.

API-Wide URL parameters

Indent formats the server response to more human readable format.

Response structure

Journeys API response is structured as follows:

The response has headers and data elements. Data element contains the actual response data, and its content varies depending on the request made by the client. Headers contain metadata-like information about the response. startIndex tells the index of the first returned element, pageSize tells how many items were returned and moreData tells if the client should make another request to fetch the additional data. This approach is called "paging". The client can specify startIndex parameter to the request URL to specify the starting index of an entity list, for example:

If omitted, the Journeys API assumes startIndex to be zero.

In case of a malformed request, such as wrongly formatted coordinate strings, server responds with a fail message:

In internal server error cases, server responds with similar response, except the status is "error":

Entity Queries

About Query Parameters

Journeys API allows the client user URL parameters in queries. You can find out valid query parameters for each entity on this page. A client can issue none or all query parameters in a query. For example a client could query:

by using multiple query parameters.

Query Parameter Reference

Below you can find allowed query parameters by Journeys API url.

Field Exclusion

Journeys API allows exclusion of returned fields depending on the end point. Below are list of end points which allow field exclusion.

For each end point a single or multiple exclusion can be used. Multiple exclusions are separated by comma. For example a client might call:

Also the vehicle-activity end point support field exclusion, please see that section for details on field exclusion on vehicle-activity end point

About IDs

Each entity in Journeys API has an id (the url field ends to it), for example in line id "Y4" in url

ROUTEs, JOURNEYs, MUNCIPALITIES and JOURNEY PATTERNs have ids which are likely change over time. These ids should be stored in the client only for short periods of time.

A client can access specific LINE'S details by issuing request at http://data.itsfactory.fi/journeys/api/1/lines/13

This request would produce following response:

A client can search LINES by issuing for example following requests:

A client can access specific ROUTE'S details by issuing request at http://data.itsfactory.fi/journeys/api/1/routes/288

In addition to its own url, a ROUTE contains url to the LINE under which it is running. ROUTE has a name. ROUTE also has references to JOURNEY PATTERNs and JOURNEYs operating on it. geographicCoordinateProjection contains information on how to draw the route on a map. This field is encoded to save bandwidth and the client must decode the fields value. The field takes form:

These are encoded coordinates, in a form of:

a client would decode the field by substracting delta lon2 from lon1 as well as substracting delta lat2 from lat1 and dividing result with 1e5. This would result in a coordinate pair from which delta lat3 and delta lon3 could again be substracted and so on. First lat1 and lon1 should be just divided with 1e5. For example:

First ":"-separated value is 6131429,2375268. First pair of coordinates can be obtained by dividing comma separated values with 1e5. Therefore first coordinate pair would be

Second coordinate pair would be obtained by substracting:

Respectively, third coordinate pair would be obtained by substracting:

And so on.

A client can access specific JOURNEY'S details by issuing request at http://data.itsfactory.fi/journeys/api/1/journeys/2010

JOURNEY element contains property called "call". A call is NeTEx element which binds together journeys arrival and departure times with STOP POINT information. For example the JOURNEY in the response has three calls: first call tells that the JOURNEY start time and that it starts from STOP POINT with id 222. activityUrl points to records of journey's current activity on the street network (assuming a vehicle is operating currently on this journey). Please see chapter "Vehicle Activity" for more details.

A client can search JOURNEYS by issuing following requests:

Journey Patterns

A client can access specific JOURNEY PATTERNS details by issuing request at http://data.itsfactory.fi/journeys/api/1/journey-patterns/260

A JOURNEY PATTERN contains references to STOP POINTs (which form the JOURNEY PATTERN) as well as references to JOURNEYs which run on this JOURNEY PATTERN.

Stop Points

A client can access specific STOP POINTS details by issuing request at http://data.itsfactory.fi/journeys/api/1/stop-points/0001

A client can search STOP POINTS by issuing following requests:

About Tariff Zones

Journeys API returns tariff zones as tariff zone ids defined by City of Tampere. Valid tariff zone ids are: A,B,C,D,E,F and G

Please see http://joukkoliikenne.tampere.fi/en/tickets-fares/traffic-zones.html for more details on tariff zones.

A client can access specific municipalities details by issuing request at http://data.itsfactory.fi/journeys/api/1/municipalities/837

Vehicle Activity

Journeys API allows clients to access real-time location of vehicles moving through the street network. To do this, client would make a HTTP GET request to url

The call would result in a following response:

The response contains a list of elements described above. Each element corresponds to a active vehicle currently operating in the road network. Following fields are present:

The client can filter activity by issuing following query parameters:

The client can also filter certain fields from the response. Filtering is based on exclude-fields url parameter. Filtered field names are nested. Client can specify multiple filtered fields as comma-separated list. For example to filter out recordedAtTime and onwardCalls elements, the client would make following request

Stop Monitoring

Journeys API allows clients to access real-time location of vehicles moving through the street network from stop point perspective. To do this, client would make a HTTP GET request to url

where stops argument contains a list of stop short names for which to fetch the data. NOTE: you can specify at maximum 100 stop short names into single request The call would result in a following response:

The response contains a list of elements (grouped by requested stop short names) described above. Following fields are present:

The response data changes once in a minute, so clients are not recommended to poll the interface very often.

GTFS Zip files

Journeys API provides public transport data in form of GTFS ZIP files. These files are meant for purposes where offline usage of public transport data is required. Please see https://developers.google.com/transit/gtfs/reference for more details on GTFS.

Zip files are available at: http://data.itsfactory.fi/journeys/files/gtfs/

Journeys API provides two zip files:

Support / Community

You can contact us via email: email@example.com

You can also visit Journeys API Facebook page at https://www.facebook.com/journeysapi, where we update news and other noteworthy issues and you can ask questions as well.
[null, {"document_url": "http://wiki.itsfactory.fi/index.php?title=Journeys_API&oldid=1782", "unformatted_src": "/images/4/44/Journeys_API_Network.png", "src": "https://wiki.itsfactory.fi/images/4/44/Journeys_API_Network.png", "formatted_filename": "Journeys API Network", "alt_text": "Journeys API Network.png", "rendered_width": 566, "rendered_height": 679}, null, {"document_url": "http://wiki.itsfactory.fi/index.php?title=Journeys_API&oldid=1782", "unformatted_src": "/images/e/ef/API_Entities_1.1.png", "src": "https://wiki.itsfactory.fi/images/e/ef/API_Entities_1.1.png", "formatted_filename": "API Entities", "alt_text": "API Entities 1.1.png", "rendered_width": 846, "rendered_height": 299}, null, {"document_url": "http://wiki.itsfactory.fi/index.php?title=Journeys_API&oldid=1782", "unformatted_src": "/images/thumb/8/89/Journ_Line_2.png/400px-Journ_Line_2.png", "src": "https://wiki.itsfactory.fi/images/thumb/8/89/Journ_Line_2.png/400px-Journ_Line_2.png", "formatted_filename": "px Journ Line", "alt_text": "Journ Line 2.png", "rendered_width": 400, "rendered_height": 286}, null]