{ "x-generator": "NSwag v12.0.10.0 (NJsonSchema v9.13.11.0 (Newtonsoft.Json v11.0.0.0))", "swagger": "2.0", "info": { "title": "Anyways Transit API", "description": "Welcome to documentation of the Anyways BVBA Transit API.
\nThe API offers routing over various public transport networks, such as train, bus, metro or tram networks.The heavy lifting of the routing is done by the Itinero-transit library, which is built to use Linked Connections.
\n

Usage of the API

To query for a route using public transport, the API can be freely queried via HTTP. To do this, one must first obtain the identifiers of the departure and arrival stations. In the linked data philosophy, an identifier is an URL referring to a station. To obtain a station, one can either use the LocationsAround or LocationsByName endpoints. Please see the swagger documentation for more details.

Once that the locations are known, a journey over the PT-network can be obtained via the Journey-endpoint. Again, see the swagger file for a detailed explanation.

Status of the live server

The demo endpoint only loads a few operators over a certain timespan. To see which operators are loaded during what time, consult the status endpoint.

Deploying the server

To deploy your own Transit-server, use appsettings.json to specify the connection URLs of the operator which you want to load. An example can be found here

", "termsOfService": "None", "contact": { "name": "Anyways", "url": "https://www.anyways.eu", "email": "info@anyways.eu" }, "version": "v1" }, "host": "localhost:5001", "schemes": [ "https" ], "paths": { "/Journey": { "get": { "tags": [ "Journey" ], "summary": "Creates a journey over the public-transport network.", "description": "You do not have to provide both departure and arrival times, one of them is enough.\nWhen both are given, all possible journeys between those points in time are calculated.\nIf only one is given, a fastest possible test route is created. Then, the taken time is doubled and all possible journeys between `(journey.Departure, journey.Departure + 2*journey.TotalTime)` are given.", "operationId": "Journey_Get", "produces": [ "text/plain", "application/json", "text/json" ], "parameters": [ { "type": "string", "name": "from", "in": "query", "description": "The location where the journey starts, e.g. http://irail.be/stations/NMBS/008891009", "x-nullable": true }, { "type": "string", "name": "to", "in": "query", "description": "The location where the traveller would like to go, e.g. http://irail.be/stations/NMBS/008892007", "x-nullable": true }, { "type": "string", "name": "departure", "in": "query", "description": "The earliest moment when the traveller would like to depart, in ISO8601 format", "format": "date-time", "x-nullable": true }, { "type": "string", "name": "arrival", "in": "query", "description": "The last moment where the traveller would like to arrive, in ISO8601 format", "format": "date-time", "x-nullable": true }, { "type": "integer", "name": "internalTransferTime", "in": "query", "description": "The number of seconds the traveller needs to transfer trains within the station. Increase for less mobile users", "default": 180, "x-nullable": false } ], "responses": { "200": { "x-nullable": true, "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/Journey" } } }, "404": { "description": "" }, "400": { "description": "" } } } }, "/Location": { "get": { "tags": [ "Location" ], "summary": "Gets information about a location, based on the location id", "operationId": "Location_Get", "produces": [ "text/plain", "application/json", "text/json" ], "parameters": [ { "type": "string", "name": "id", "in": "query", "description": "The identifier of the location, e.g. 'http://irail.be/stations/NMBS/008891009'", "x-nullable": true } ], "responses": { "200": { "x-nullable": true, "description": "", "schema": { "$ref": "#/definitions/Location" } }, "404": { "description": "" } } } }, "/LocationsAround": { "get": { "tags": [ "LocationsAround" ], "summary": "Searches for stops which are at most 500 meters north, east, south or west from the specified point.", "description": "Note that we construct a bounding square around `(lat, lon)`, namely `(lat - distance, lon - distance, lat + distance, lon + distance)`.\nThis implies that the maximal (Euclidian) distance between the specified location and a resulting location can be up to `sqrt(2) * distance`.", "operationId": "LocationsAround_Get", "produces": [ "text/plain", "application/json", "text/json" ], "parameters": [ { "type": "number", "name": "lat", "in": "query", "description": "The WGS84-latitude point of where to search", "format": "double", "x-nullable": false }, { "type": "number", "name": "lon", "in": "query", "description": "The WGS84-longitude point of where to search", "format": "double", "x-nullable": false }, { "type": "number", "name": "distance", "in": "query", "description": "The maximal distance north, east, south or west that the resulting locations could be.", "format": "double", "default": 500.0, "x-nullable": false } ], "responses": { "200": { "x-nullable": true, "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/Location" } } }, "404": { "description": "" } } } }, "/LocationsByName": { "get": { "tags": [ "LocationsByName" ], "summary": "Searches for stops having the given name or something similar. ", "description": "A match is calculated as following:\nFirst, all characters are lowercased and non [a-z]-characters are removed.\n0) Then, we search for an exact match (which will get a 'difference' score of **0**).\n1) Secondly, a number of acronyms are automatically calculated for each station, namely:\n The initials (e.g. Gent-Sint-Pieter will be shortened to GSP;)\n The first two letters, followed by initials (Brussel-Centraal becomes BrC).\n These are returned with a difference number of **1**.\n2) If the station name starts with the requested query, it is returned with a value of **2**\n3) At last, stations are matched with a string distance function. If the string distance is smaller then 5, it is returned.\n The difference will be the string comparison difference + 1", "operationId": "LocationsByName_Get", "produces": [ "text/plain", "application/json", "text/json" ], "parameters": [ { "type": "string", "name": "name", "in": "query", "x-nullable": true } ], "responses": { "200": { "x-nullable": true, "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/LocationResult" } } }, "404": { "description": "" } } } }, "/Status": { "get": { "tags": [ "Status" ], "summary": "Gives some insight in the database", "operationId": "Status_Get", "produces": [ "text/plain", "application/json", "text/json" ], "responses": { "200": { "x-nullable": true, "description": "", "schema": { "$ref": "#/definitions/StatusReport" } } } } } }, "definitions": { "Journey": { "type": "object", "description": "A journey.", "additionalProperties": false, "required": [ "travelTime", "transfers" ], "properties": { "segments": { "type": "array", "description": "All the individual segments:\n one segment for each train/bus/... the traveller takes\n ", "items": { "$ref": "#/definitions/Segment" } }, "departure": { "description": "The departure time and location of this journey. Same as `segments.first().departure`", "allOf": [ { "$ref": "#/definitions/TimedLocation" } ] }, "arrival": { "description": "The arrival time and location of this journey. Same as `segments.last().arrival`", "allOf": [ { "$ref": "#/definitions/TimedLocation" } ] }, "travelTime": { "type": "integer", "description": "The total travel time in seconds. Equals `arrival.time - departure.time", "format": "int32" }, "transfers": { "type": "integer", "description": "The total number of intermediate transfers. Equals `segments.Length - 1`", "format": "int32" } } }, "Segment": { "type": "object", "description": "A segment represents a part of the journey, e.g. one link where you take the train ", "additionalProperties": false, "properties": { "departure": { "description": "The departure location.", "allOf": [ { "$ref": "#/definitions/TimedLocation" } ] }, "arrival": { "description": "The arrival location.", "allOf": [ { "$ref": "#/definitions/TimedLocation" } ] }, "vehicle": { "type": "string", "description": "The identifier of the vehicle" }, "headsign": { "type": "string", "description": "The name of the train, e.g. its destination" } } }, "TimedLocation": { "type": "object", "description": "A location and time.", "additionalProperties": false, "required": [ "time" ], "properties": { "location": { "description": "The location.", "allOf": [ { "$ref": "#/definitions/Location" } ] }, "time": { "type": "string", "description": "The time.", "format": "date-time" } } }, "Location": { "type": "object", "description": "A location.", "additionalProperties": false, "required": [ "lat", "lon" ], "properties": { "lat": { "type": "number", "description": "The latitude.", "format": "double" }, "lon": { "type": "number", "description": "The longitude.", "format": "double" }, "id": { "type": "string", "description": "The id." }, "name": { "type": "string", "description": "The name." } } }, "LocationResult": { "type": "object", "description": "Result when querying a location", "additionalProperties": false, "required": [ "difference", "importance" ], "properties": { "location": { "description": "The location.", "allOf": [ { "$ref": "#/definitions/Location" } ] }, "difference": { "type": "integer", "description": "The difference.", "format": "int32" }, "importance": { "type": "integer", "description": "Gives an indication how important a station is. The higher the number, the more trains pass there." } } }, "StatusReport": { "type": "object", "description": "The status report gives some insight in the server.", "additionalProperties": false, "required": [ "onlineSince", "uptime" ], "properties": { "loadedTimeWindows": { "type": "array", "description": "Indicates what time fragments are loaded into the database.\nThis is a list of (start, end) values", "items": { "$ref": "#/definitions/ValueTupleOfDateTimeAndDateTime" } }, "version": { "type": "string", "description": "A small string so that the programmer knows a little what version is running.\nShould be taken with a grain of salt" }, "onlineSince": { "type": "string", "description": "When the server got online", "format": "date-time" }, "uptime": { "type": "integer", "description": "The time (in seconds) that the server has been running", "format": "int64" } } }, "ValueTupleOfDateTimeAndDateTime": { "type": "object", "additionalProperties": false, "required": [ "item1", "item2" ], "properties": { "item1": { "type": "string", "format": "date-time" }, "item2": { "type": "string", "format": "date-time" } } } } }