Resources

The resources use a data model that is supported by a set of client-side libraries that are made available on the files and libraries page.

name path methods description
BikeRental
  • /otp/routers/{ignoreRouterId}/bike_rental
  • GET
GraphInspectorTileResource
  • /otp/routers/{ignoreRouterId}/inspector/layers
  • /otp/routers/{ignoreRouterId}/inspector/tile/{layer}/{z}/{x}/{y}.{ext}
  • GET
  • GET
Slippy map tile API for rendering various graph information for inspection/debugging purpose (bike safety factor, connectivity...).

One can easily add a new layer by adding the following kind of code to a leaflet map:

   var bikesafety = new L.TileLayer(
      'http://localhost:8080/otp/routers/default/inspector/tile/bike-safety/{z}/{x}/{y}.png',
      { maxZoom : 22 });
   var map = L.map(...);
   L.control.layers(null, { "Bike safety": bikesafety }).addTo(map);
 

Tile rendering goes through TileRendererManager which select the appropriate renderer for the given layer.

GraphInspectorVectorTileResource
  • /otp/routers/{ignoreRouterId}/inspector/vectortile/{layers}/tilejson.json
  • /otp/routers/{ignoreRouterId}/inspector/vectortile/{layers}/{z}/{x}/{y}.pbf
  • GET
  • GET
Slippy map vector tile API for rendering various graph information for inspection/debugging purposes.
IndexAPI
  • /otp/routers/{ignoreRouterId}/index/feeds
  • /otp/routers/{ignoreRouterId}/index/patterns
  • /otp/routers/{ignoreRouterId}/index/routes
  • /otp/routers/{ignoreRouterId}/index/services
  • /otp/routers/{ignoreRouterId}/index/stops
  • /otp/routers/{ignoreRouterId}/index/agencies/{feedId}
  • /otp/routers/{ignoreRouterId}/index/feeds/{feedId}
  • /otp/routers/{ignoreRouterId}/index/patterns/{patternId}
  • /otp/routers/{ignoreRouterId}/index/routes/{routeId}
  • /otp/routers/{ignoreRouterId}/index/services/{serviceId}
  • /otp/routers/{ignoreRouterId}/index/stops/{stopId}
  • /otp/routers/{ignoreRouterId}/index/trips/{tripId}
  • /otp/routers/{ignoreRouterId}/index/agencies/{feedId}/{agencyId}
  • /otp/routers/{ignoreRouterId}/index/patterns/{patternId}/alerts
  • /otp/routers/{ignoreRouterId}/index/patterns/{patternId}/geometry
  • /otp/routers/{ignoreRouterId}/index/patterns/{patternId}/semanticHash
  • /otp/routers/{ignoreRouterId}/index/patterns/{patternId}/stops
  • /otp/routers/{ignoreRouterId}/index/patterns/{patternId}/trips
  • /otp/routers/{ignoreRouterId}/index/routes/{routeId}/alerts
  • /otp/routers/{ignoreRouterId}/index/routes/{routeId}/patterns
  • /otp/routers/{ignoreRouterId}/index/routes/{routeId}/stops
  • /otp/routers/{ignoreRouterId}/index/routes/{routeId}/trips
  • /otp/routers/{ignoreRouterId}/index/stops/{stopId}/alerts
  • /otp/routers/{ignoreRouterId}/index/stops/{stopId}/patterns
  • /otp/routers/{ignoreRouterId}/index/stops/{stopId}/routes
  • /otp/routers/{ignoreRouterId}/index/stops/{stopId}/stoptimes
  • /otp/routers/{ignoreRouterId}/index/stops/{stopId}/transfers
  • /otp/routers/{ignoreRouterId}/index/trips/{tripId}/alerts
  • /otp/routers/{ignoreRouterId}/index/trips/{tripId}/geometry
  • /otp/routers/{ignoreRouterId}/index/trips/{tripId}/semanticHash
  • /otp/routers/{ignoreRouterId}/index/trips/{tripId}/stops
  • /otp/routers/{ignoreRouterId}/index/trips/{tripId}/stoptimes
  • /otp/routers/{ignoreRouterId}/index/agencies/{feedId}/{agencyId}/alerts
  • /otp/routers/{ignoreRouterId}/index/agencies/{feedId}/{agencyId}/routes
  • /otp/routers/{ignoreRouterId}/index/stops/{stopId}/stoptimes/{date}
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
  • GET
PlannerResource
  • /otp/routers/{ignoreRouterId}/plan
  • GET
This is the primary entry point for the trip planning web service. All parameters are passed in the query string. These parameters are defined as fields in the abstract RoutingResource superclass, which also has methods for building routing requests from query parameters. This allows multiple web services to have the same set of query parameters. In order for inheritance to work, the REST resources are request-scoped (constructed at each request) rather than singleton-scoped (a single instance existing for the lifetime of the OTP server).
Routers
  • /otp/routers
  • /otp/routers/{ignoreRouterId}
  • GET
  • GET
This REST API endpoint returns some meta-info about a router. OTP2 does no longer support remotely loading, reloading, and evicting graphs on a running server (Supported in OTP1).

The HTTP verbs are used as follows:

GET - see the registered routerIds(there is just one: default) with the graph.

The HTTP request URLs are of the form /otp/routers/{routerId}. The {routerId} is kept to be backward compatible, but the value is ignored. There is only one router, the "default" and that is returned - even if you specify something else.

ServerInfo
  • /otp
  • GET
UpdaterStatusResource
  • /otp/routers/{ignoreRouterId}/updaters
  • /otp/routers/{ignoreRouterId}/updaters/{updaterId}
  • GET
  • GET
Report the status of the graph updaters via a web service.

Data Types

JSON

type description
ApiAbsoluteDirection An absolute cardinal or intermediate direction.
ApiAgency
ApiAlert
ApiBookingInfo Info about how a trip might be booked at a particular stop. All of this is pass-through information, except information about booking time and booking notice.
ApiBookingTime Represents either an earliest or latest time a trip can be booked relative to the departure day of the trip.
ApiConfigInfo
ApiContactInfo How to contact the agency to book a trip or requests information.
ApiFeedInfo
ApiItinerary An Itinerary is one complete way of getting from the start location to the end location.
ApiItineraryFares
ApiLeg One leg of a trip -- that is, a temporally continuous piece of the journey that takes place on a particular vehicle (or on foot).
ApiPatternShort
ApiPlace A Place is where a journey starts or ends, or a transit stop along the way.
ApiProjectVersion
ApiRealTimeState The real-time state of a trip
ApiRelativeDirection Represents a turn direction, relative to the current heading.

CIRCLE_CLOCKWISE and CIRCLE_CLOCKWISE are used to represent traffic circles.

ApiRoute
ApiRouteShort
ApiRouterInfo
ApiRouterList
ApiServerInfo
ApiStop
ApiStopShort
ApiStopTimesInPattern
ApiSystemNotice A system notice is used to tag elements with system information.

One use-case is to run a routing search in debug-filter-mode and instead of removing itineraries from the result, the itineraries could be tagged instead. These notices are meant for system testers and developers and should not be used for end user notification or alerts.

ApiTransfer Represents a transfer from a stop
ApiTravelOption This class is used to send to client which Travel Options are possible on this server

This options are used in client "Travel by" drop down.

Each travel option consist of two variables: - value is a value which is sent to the server if this is chosen ("TRANSIT, WALK", "CAR", etc.) - name is a name with which client can nicely name this option even if specific value changes ("TRANSIT", "PARKRIDE", "TRANSIT_BICYCLE", etc.)

Travel options are created from org.opentripplanner.routing.graph.Graph transitModes variable and based if park & ride, bike & ride, bike sharing is supported. List itself is created in ApiTravelOptionsMaker#makeOptions(HashSet, boolean, boolean, boolean)

ApiTrip
ApiTripPlan A TripPlan is a set of ways to get from point A to point B at time T.
ApiTripSearchMetadata Meta-data about the trip search performed.
ApiTripShort
ApiTripTimeShort
ApiVehicleParkingSpaces
ApiVehicleParkingWithEntrance The details of a parking place along with the entrance used.
ApiVehicleRentalStation
ApiVehicleRentalStationList
ApiVersionControlInfo
ApiVertexType Represent type of vertex, used in Place aka from, to in API for easier client side localization
ApiWalkStep Represents one instruction in walking directions. Three examples from New York City:

Turn onto Broadway from W 57th St (coming from 7th Ave):
distance = 100 (say)
walkDirection = RIGHT
streetName = Broadway
everything else null/false

Now, turn from Broadway onto Central Park S via Columbus Circle
distance = 200 (say)
walkDirection = CIRCLE_COUNTERCLOCKWISE
streetName = Central Park S
exit = 1 (first exit)
immediately everything else false

Instead, go through the circle to continue on Broadway
distance = 100 (say)
walkDirection = CIRCLE_COUNTERCLOCKWISE
streetName = Broadway
exit = 3
stayOn = true
everything else false

Cloneable
Coordinate
CoordinateSequence
CoordinateSequenceFactory
DebugOutput Holds information to be included in the REST Response for debugging and profiling purposes.
ElevationMetadata Contains elevation-specific metadata to be included in the response

Created by demory on 2/16/17.

EncodedPolyline A list of coordinates encoded as a string.

See Encoded polyline algorithm format

Envelope
Geometry
GeometryFactory
InspectorLayer
InspectorLayersList
Message The purpose of Messages is to read supply Message.properties to underlying calling code... The ENUM's enumerated values should be named to reflect the property names inside of Message.properties
PlannerError This API response element represents an error in trip planning.
Point
PrecisionModel
Record
TileJson Container for TileJSON response
TransitTimingOutput Holds information to be included in the REST Response for debugging and profiling purposes of a single transit routing search.
TripPlannerResponse Represents a trip planner response, will be serialized into XML or JSON by Jersey
Type
VehicleRentalStationUris Contains rental URIs for Android, iOS, and web in the android, ios, and web fields. See the GBFS station_information.json specification for more details.