User Tools

Site Tools


core:mobilityservice

Mobility Service

The use of the service is twofold.

First, the service provides an access to the local transport network information. This includes the static and real-time information about the public transport schedules and their deviations, information about parking structures and their real-time filling, information about road works and blocks, etc.

Second, it provides the functionality of multimodal route planner, enabling planning for public transport and a car, bycicle routes, considering also the bike sharing stations and parkings near by, etc. Besides, the service allows the user to store the planned routes and perform their monitoring, signalling possible problems (e.g., delays, strikes, accidents, etc).

Note that these functionalities are strongly related: the multimodal route planner takes the real-time information into account either directly during the plan construction or through the warnings that are shown/notified to the user with respect to her plan.

Corresponding to these functionalities the service operates the following data structures:

  • parking data, including the location, capacity and real-time state.
  • road info, that describe the road works, their effect on the possibility to move, timing, etc.
  • routes, trips, and stops, describing the individual public transport lines and their timetable.
  • complete timetable data describing static public transport time information for stops and lines, including also real-time delays.
  • alerts representing the real-time mobility data changes (accidents, delays, work in progress, strikes, etc).
  • single and recurrent journey used to capture multimodal route plan outcomes and their monitoring definitions.

Data Types

The following data structures are operated by the service.

1. Public Transport Network Information

Public transport network relies on the concept of agency, which logically corresponds to a public entity managing certain mobility network systems. Each agency is identified with its agencyId. Currently, the following agencies are due:

Agency ID Agency description
12 Trento City Bus (TrentinoTrasporti)
10 Trento-Male' railway (FTM di TrentinoTrasporti)
5 Bolzano-Verona railway line (Trenitalia)
6 Trento-Bassano di Grappa railway line (Trenitalia)
16 Rovereto City Bus (TrentinoTrasporti)
17 Trentino Intercity Bus (TrentinoTrasporti)
COMUNE_DI_TRENTO Parkings of Trento
COMUNE_DI_ROVERETO Parkings of Rovereto
BIKE_SHARING_TRENTO Bike sharing stations of Trento
BIKE_SHARING_ROVERETO Bike sharing stations of Rovereto
CAR_SHARING_SERVICE Car sharing stations of Trento

Another important type of information is the transport type enumeration. Currently, the following types are considered:

Value Description
CAR Private car
BICYCLE Bicycle
TRANSIT Public transport
SHAREDBIKE Bicycle with a constraint to move between bike sharing points
SHAREDBIKE_WITHOUT_STATION Shared bicycle with a constraint to move from a bike sharing point
CARWITHPARKING Private car with a constraint to move to a parking close to destination
SHAREDCAR Shared car with a constraint to move between car sharing points
SHAREDCAR_WITHOUT_STATION Shared car with a constraint to move from a car sharing point
BUS Public bus, a subset of public transport
TRAIN Trains, a subset of public transport
WALK pedestrian walk
SHUTTLE Shuttle bus, a subset of public transport
GONDOLA Auxiliary transports, such as cable cars
  • Route: represents a line of the public transport network agency. Contains
    • routeId: unique route identificator with
      • agency: id of the agency
      • id: line id
    • routeShortName: short name of the line (e.g., '1')
    • routeLongName: long name of the line (e.g., 'Roncafort - P.Dante - Osp.S.Chiara- Roncafort')
  • Stop: represent a transport stop with
    • stopId: unique stopId (string)
    • name
    • latitude
    • longitude
  • StopTime: represent information about when a transport line passes at the stop with
    • time: timestamp
    • trip: specific trip identificator with
      • agency: agency Id
      • id: trip ID
  • TripData: information about when a transport line passes at the stop with
    • time: timestamp
    • agencyId
    • routeId (string)
    • tripId (string)
    • routeName: long name
    • routeShortName
    • delay: information about delay.
  • Delay: information about delay with
    • values: key-value map to distinguish different delay sources. Specifically, USER key specifies that the delay is signaled by the users, while SERVICE specifies that the delay info is obtained from external (transport provider) source. The value is in minutes (string).
  • TimeTable: information about transport line timetable (for specific days) with
    • tripIds: list of trip Ids of the line
    • stops: list of stop names that appear on this timetable
    • stopsId: list of stop IDs
    • times: three-dimensional array of trip timing across the lines for several days, where the time is either empty (not stopping at the corresponding stop) or in the format 'HH:mm'
    • delays: real time information about the trip delays (two-dimensional array with delays for different days).
  • Parking: information about parkings and their availability
    • name: identificator of the parking
    • description: detailed name of the parking
    • position: array of coordinates [lat,lon] of the parking
    • monitored: whether the real time information is supported
    • slotsTotal: total places at parking
    • slotsAvailable: currently available slots (valid value only if monitored=true)
  • Compressed Timetable: information about transport line timetable in a compressed form used for incremental timetable updates. Contains
    • stops: array of stop name
    • stopIds: array of stop identificators
    • tripIds: array of trips due at this timetable
    • compressedTimes: an encoded time string that encodes a sequence of times for each trip sequentially. The time at stop is represented with 4 symbols (hours/minutes) or with '|' symbol meaning trip not passes the stop.

2. Real-time Information Updates

The data structures below represent the real time updates that can be signaled to the system: delays, strikes, accidents, etc. These structures, or alerts have the following common elements:

  • id: alert ID (string)
  • description: alert text
  • creatorId: ID of the creator (e.g., user ID in case of user alerts)
  • creatorType: type of the source, either USER or SERVICE.
  • from: timestamp of the start of the interval in which the alert is valid
  • to: timestamp of the end of the interval in which the alert is valid
  • effect: description of the update impact on the transport network (e.g., road blocked)
  • type: category of the alert, one of DELAY, ACCIDENT, ROAD, STRIKE, PARKING or CUSTOM.
  • note: additional info for the alert
  • entity: reference to the social entity ID, if any.

Besides, the specific alert types define additional fields:

  • AlertRoad: signals the road works or temporal traffic changes
    • agencyId: agency affected
    • changeTypes: array of change types, e.g., ROAD_BLOCK, PARKING_BLOCK, DRIVE_CHANGE, OTHER.
    • road: descrpition of the road where change is due
      • lat: latitude of the reference position
      • lon: longitude of the reference position
      • streetCode: street identifier
      • street: street name
      • fromNumber/toNumber: optional house range affected
      • fromIntersection/toIntersection: optional intersection range affected
      • note: additional info about the change
  • AlertDelay: represent the public transport delay information
    • position: structure describing the location where alert is due. Describes the local transport stop
      • name: name of the stop
      • stopId containing fields agencyId and id
      • lat: position latitude
      • lon: position longitude
    • transport: description of the affected transport
      • type: type enumeration of the transport.
      • agencyId: agency of the transport affected
      • routeId: affected line
      • routeShortName: affected line short name
      • tripId: affected trip
    • delay: delay in seconds
  • AlertStrike: strike for the public transport
    • stopId: descriptor of the affected stop containing fields agencyId and id
    • transport: description of the affected transport
      • type: type enumeration of the transport.
      • agencyId: agency of the transport affected
      • routeId: affected line
      • routeShortName: affected line short name
      • tripId: affected trip
  • AlertAccident: description of the road accident
    • position: structure describing the location where alert is due.
    • severity: textual description of the accident impact
  • AlertParking: parking update defining change in the slot availability
    • stopId: descriptor of the affected parking containing fields agencyId and id
    • placesAvailable: value for available slots
    • noOfvehicles: number of shared vehicles if applies

3. Journeys

These data structures represent the route plans and the user-defined information on top of those, such as, e.g., monitoring instructions. Specifically, the following structures are due

  • Position: describe a start/end point of the route or its leg. May refer to an arbitrary position on map or to a specific place, such as bus stop, car parking, etc.
    • lat: latitude (string)
    • lon: longitude (string)
    • name: optional name of the place, when refers to, e.g., bus stop
    • stopId: optional stop identifier (with agencyId and id of the stop), when refers to, e.g., bus stop
    • stopCode: optional stop code, when refers to, e.g., bus stop
  • SingleJourney: planning request descriptor for a single journey plan
    • from: departure position (Position)
    • to: arrival position (Position)
    • date: the date of the trip (string in format mm/dd/yyyy)
    • departureTime: time, after which the trip should start (string in format hh:mm)
    • transportTypes: array of allowed transport types to consider
    • routeType: instruction to guide the route planning, one of fastest, healthy, leastWalking, leastChanges, greenest, safest.
    • resultsNumber: number of results to return.
  • Leg: represent an element of the single route planning result.
    • legId: identifier of the leg
    • startTime/endTime: start/end time of the leg (timestamp)
    • duration: duration of the leg (in milliseconds)
    • from/to: departure/arrival positions of the leg (Position)
    • transport: descriptor of the transport mean with
      • type: transport type enum
      • agencyId: optional agency, if applies
      • routeId: transport line identifier, if applies
      • routeShortName: short name of the line, if applies
      • tripId: identifer of the specific transport trip, if applies
    • legGeometry: descriptor of the path for graphical representation
      • length: length of the path (in meters)
      • points: Google Maps encoded path (string)
      • levels: descriptor of the path elevation
    • alertStrikeList: list of strike alerts due for this leg
    • alertDelayList: list of delay alerts due for this leg
    • alertParkingList: list of parking alerts due for this leg
    • alertRoadList: list of road alerts due for this leg
    • alertAccidentList: list of accident alerts due for this leg
  • Itinerary: represent the result of the single route planning
    • from/to: departure/arrival positions of the trip (Position). Should correspond to the requested ones.
    • startTime/endTime: start/end times of the whole trip (timestamp).
    • duration: total duration of the whole trip.
    • walkingDuration: duration of the walks within the trip, if any.
    • leg: list of Leg instances contained in the trip.
  • RecurrentJourneyParameters: planning request descriptor for a recurrent journey plan
    • recurrence: array of days of week for which to plan (array of integers). Sunday corresponds to 1, Monday to 2, etc.
    • from/to: departure/arrival positions to plan for (Position).
    • fromDate/toDate: date interval for recurrent journey (timestamp)
    • interval: time interval for the recurrent journey (milliseconds). At most two hours.
    • transportTypes: array of allowed transport types to consider
    • routeType: instruction to guide the route planning, one of fastest, healthy, leastWalking, leastChanges, greenest, safest.
    • resultsNumber: number of results to return.
  • RecurrentJourney: represent the recurrent journey plan results. Does not contain the exact itineraries, but also the transport info for monitoring.
    • parameters: request information (RecurrentJourneyParameters)
    • legs: array of simplified representation of different legs resulting in recurrent journey
      • from/to: textual representation of the departure/arrival places
      • transport: description of the transport on the leg, with
        • type: transport type enum
        • agencyId: optional agency, if applies
        • routeId: transport line identifier, if applies
        • routeShortName: short name of the line, if applies
        • tripId: identifer of the specific transport trip, if applies
    • monitorLegs: legs to be monitored. A map with leg tripId as the key and true/false as the value.
  • BasicItinerary: user's representation of the trip to be stored.
    • clientId: id of the saved trip (string).
    • data: itinerary itself (Itinerary)
    • monitor: whether the trip is monitored or not (true/false)
    • originalFrom/originalTo: departure/arrival positions as of request (Position).
    • name: name assigned by the user to this trip
  • BasicRecurrentJourney: user's representation of the recurrent trip to be stored.
    • clientId: id of the saved trip (string).
    • data: recurrent journey itself (RecurrentJourney)
    • monitor: whether the trip is monitored or not (true/false)
    • name: name assigned by the user to this trip

Service Usage Scenarios

1. Access transport information

The following operations are allowed

  • retrieve the lines (routes) of the specific transport agency
  • retrieve the stops across the specific line of an agency
  • retrieve the times of a single line at a stop or of all the lines at the stop (including delays)
  • retrieve the timetable of the line for a specific day
  • retrieve the line delays
  • retrieve the information about parkings, possibly with the real-time availability info
  • retrieve the real-time information about road works, deviations, and blocks

2. Real-time updates

These scenarios allow one to signal the real-time information relevant for monitored/planned trips.

  • signal (as a user or as a info provider) a transport delay
  • signal (as a user or as a info provider) a parking availability changes
  • signal (as a user or as a info provider) an accident
  • signal (as a user or as a info provider) a road work or a road block
  • signal (as a user or as a info provider) a transport strike

3. Plan trips

  • plan a single trip from/to specified points at specified time, using specified transport means
  • obtain information about trips falling under specified days/time interval for the specified origin and destination to be used for monitoring (recurrent journey planning)
  • save planned single or recurrent trips
  • switch trip monitoring on and off
  • modify the recurrent journey
  • delete stored trips

4. Get trip notifications

  • receive notifications for the monitored trips, such as delays, strikes, accidents, parking availability, road works, etc.

Currently, the following notifications are possible for the different object types:

  • delay, for the public transport legs
  • parking, for the car legs ending at parking

The notifications will contain the following data (see Communicator Service for the detailed description of the notification attributes):

  • type: 'core.mobility'
  • title: name of the monitored trip
  • description: alert note
  • content:
    • creatorType: USER or SERVICE
    • from/to: alert validity period
    • entities: a single entity representing the monitoriedd trip (with id, title, and type)
    • type: type of the alert (e.g., 'alertDelay' or 'alertParking')
    • for delay: agencyId, routeId, routeShortName, tripId, delay (in millis), station (i.e., name of the stop where signalled)
    • for parking: agencyId, stopId (i.e., parking), placesAvailable

Transport Information REST API

The requests are emitted to the following endpoint:

https://dev.smartcommunitylab.it/core.mobility

Read routes

The method allows for retrieving the information about transport agency lines.

Parameters

  • agencyId (path variable): agency ID

Request

GET /core.mobility/getroutes/{agencyId} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

Response (list of Route structures)

[
 {
   "id":
   {
     "id":"01",
     "agency":"12"
   },
   "routeLongName":"Roncafort - P.Dante - Osp.S.Chiara- Roncafort",
   "routeShortName":"1"
 },
 {
   "id":
   {
     "id":"10R",
     "agency":"12"
   },
   "routeLongName":"Cognola / Montevaccino - Martignano - P.Dante",
   "routeShortName":"10"
 },
 ... 
]

Read stops

The method allows for retrieving the information about transport agency stops across the specific line.

Parameters

  • agencyId (path variable): agency ID
  • routeId (path variable): line ID

Request

GET /core.mobility/getstops/{agencyId}/{routeId} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

Response (list of Stop structures)

[
   {
      "name":"RONCAFORT nord",
      "id":"22500c",
      "latitude":46.103456,
      "longitude":11.100248
   },
   {
      "name":"GARDOLO  P.le Neufahrn",
      "id":"22055n",
      "latitude":46.106678,
      "longitude":11.111444
   },
   {
      "name":"GARDOLO  \"campo sportivo",
      "id":"22005z",
      "latitude":46.105677,
      "longitude":11.107554
   }
]

Read stops in geographical area

The method allows for retrieving the information about transport agency stops within specific area.

Parameters

  • agencyId (path variable): agency ID
  • lat (query param): latitude of the area center
  • lng (query param): longitude of the area center
  • radius (query param): radius of area (1 corresponds to roughly 100km)
  • page (query param): for the results pagination, indicates the index of a “page”
  • count (query param): for the results pagination, number of results per “page”

Request

GET /core.mobility/geostops/{agencyId}?lat=<lat>&lng=<lng>&radius=<radius>&page=<page>&count=<count> HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

Response (list of Stop structures)

[
   {
      "name":"RONCAFORT nord",
      "id":"22500c",
      "latitude":46.103456,
      "longitude":11.100248
   },
   {
      "name":"GARDOLO  P.le Neufahrn",
      "id":"22055n",
      "latitude":46.106678,
      "longitude":11.111444
   },
   {
      "name":"GARDOLO  \"campo sportivo",
      "id":"22005z",
      "latitude":46.105677,
      "longitude":11.107554
   }
]

Read stop times

The method allows for retrieving the information about the time at which the specified transport line passes the specified stop (currently, plus/minus 1 hour).

Parameters

  • agencyId (path variable): agency ID
  • routeId (path variable): line ID
  • stopId (path variable): stop Id

Request

GET /core.mobility/gettimetable/{agencyId}/{routeId}/{stopId} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

Response (list of StopTime structures)

[
   {
      "name":"RONCAFORT nord",
      "id":"22500c",
      "latitude":46.103456,
      "longitude":11.100248
   },
   {
      "name":"GARDOLO  P.le Neufahrn",
      "id":"22055n",
      "latitude":46.106678,
      "longitude":11.111444
   },
   {
      "name":"GARDOLO  \"campo sportivo",
      "id":"22005z",
      "latitude":46.105677,
      "longitude":11.107554
   }
]

Read next trips at stop

The method allows for retrieving the information about next transports passing the specified stop.

Parameters

  • agencyId (path variable): agency ID
  • stopId (path variable): stop Id
  • results (path variable): number of results to return

Request

GET /core.mobility/getlimitedtimetable/{agencyId}/{stopId}/{results} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

Response (list of TripData structures)

{
   "01":{
      "delays":{},
      "name":"Roncafort - P.Dante - Osp.S.Chiara- Roncafort",
      "route":"1",
      "times":[
         {
            "time":1377092520,
            "trip":{
               "id":"01-Feriale_034",
               "agency":"12"
            }
         },
         {
            "time":1377093960,
            "trip":{
               "id":"01-Feriale_035",
               "agency":"12"
            }
         },
         {
            "time":1377095520,
            "trip":{
               "id":"01-Feriale_036",
               "agency":"12"
            }
         }
      ]
   }
}

Read line timetable

The method allows for retrieving the transport line timetable for the specified day. If the day matches current date, the available delay data is also included.

Parameters

  • routeId (path variable): routeId
  • timefrom/timeto (path variables): time interval for which to return the timetable

Request

GET /core.mobility/gettransittimes/{routeId}/{timefrom}/{timeto} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

Response (TimeTable structures)

{
   "stops":[
      "RONCAFORT nord",
      "GARDOLO  P.le Neufahrn",
      "GARDOLO  \"campo sportivo",
      "RONCAFORT",
      ...
   ],
   "stopsId":[
      "22500c",
      "22055n",
      "22005z",
      "22505c",
      ...
   ],
   "times":[
      [
         [
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "06:48",
            "06:50",
            "06:54",
            "06:55",
            "06:56",
            "06:59",
            "07:00",
            "07:01",
            "07:02",
            "07:03",
            "",
            "",
            "",
            ""
         ],
         ...
      ]
   ],
   "tripIds":[
      [
         "01-Feriale_002",
         "01-Feriale_005",
         "01-Feriale_003",
         "01-Feriale_004",
         ....
      ]
   ],
   "delays":[
      [
         {},
         {},
         {},
         {},
         ...
      ]
   ]
}

Read line delays

The method allows for retrieving the information about transport line delays for the specified time interval.

Parameters

  • routeId (path variable): line ID
  • timefrom/timeto: time interval for trips to consider

Request

GET /core.mobility/gettransitdelays/{routeId}/{timefrom}/{timeto} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

Response (TimeTable structure, with all fields but delays empty)

{
   "stops":null,
   "stopsId":null,
   "times":null,
   "tripIds":null,
   "delays":[
      [
         {
            "user": "5",
            "service": "3"

         },
         {
            "service": "2" 
         },
         {},
         {},
         ...
 
      ]
   ]
}

Read real-time timetable

The method allows for retrieving the information about transport line timetable of the current date with the real-time delay information.

Parameters

  • agencyId (path variable): agency
  • routeId (path variable): line ID

Request

GET /core.mobility/timetable/{agencyId}/{routeId} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

Response (Day TimeTable structure). Defines the list of stops and stop IDs, and list of trip times with trip delay (if any).

{
    "stopIds": [
        "TRENTO_STATION_FTM",
        "TRENTO_NORD",
        "GARDOLO",
        "Zona_Industriale",
        ...
    ],
    "stopNames": [
        "Trento Train Station FTM",
        "TRENTO NORD - Zona Comm.le",
        "GARDOLO Ferrovia",
        "Spini Zona Industriale Ferrovia",
        ...
    ],
    "trips": [
        {
            "tripId": "302",
            "delay": {
                "SERVICE": "1"
            },
            "stopTimes": [
                "05:31",
                "05:33",
                "05:37",
                "05:39",
                "05:40",
                "05:43",
                "05:47",
                "05:50",
                "05:54",
                "05:57",
                "06:00",
                "06:03",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                ""
            ]
        },
        ...
   ]
}

Read parking data

The method allows for retrieving the list of car parking with optionally the real-time availability data.

Parameters

  • agencyId (path variable): parking agency ID

Request

GET /core.mobility/getparkingsbyagency/{agencyId} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

Response (list of Parking structures)

[
   {
      "name":"via Roggia Grande,16 - Trento",
      "position":[
         46.0676,
         11.1247
      ],
      "description":"via Roggia Grande,16 - Trento",
      "monitored":false,
      "slotsTotal":100,
      "slotsAvailable":0
   },
   {
      "name":"P7",
      "position":[
         46.0657,
         11.1145
      ],
      "description":"Piazzale Roberto da Sanseverino - Trento",
      "monitored":true,
      "slotsTotal":342,
      "slotsAvailable":136
   },
   ...
]

Read bikesharing data

The method allows for retrieving the list of bikesharing stations with the real-time availability data.

Parameters

  • cityname (path variable): name of the city. Currently suppored: trento, rovereto, pergine_valsugana, lavis, mezzocorona, mezzolombardo, sanmichelealladige

Request

GET /core.mobility/bikesharing/{cityname} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json

Response (list of Station structures)

[
    {
        "name": "Brione",
        "address": "Via Perosi / Via Puccini",
        "id": "1153",
        "bikes": 1,
        "slots": 5,
        "totalSlots": 6,
        "position": [
            45.90421911950808,
            11.044299836454002
        ]
    },
    ...
]

Read road works info

The method allows for retrieving the list of work roads, deviations, road blocks, etc.

Parameters

  • agencyId (path variable): parking agency ID
  • from/to: time interval in which the info should fall (timestamps)

Request

GET /core.mobility/getroadinfobyagency/{agencyId}/{from}/time HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

Response (list of AlertRoad structures)

[
   {
      "agencyId":"COMUNE_DI_ROVERETO",
      "road":{
         "note":"",
         "lat":"45.894037",
         "lon":"11.043587",
         "streetCode":"290",
         "street":"CORSO BETTINI A.",
         "fromNumber":"",
         "toNumber":"",
         "fromIntersection":"",
         "toIntersection":""
      },
      "changeTypes":[
         "PARKING_BLOCK",
         "ROAD_BLOCK"
      ],
      "id":"612005_290",
      "type":null,
      "entity":null,
      "description":"UFFICIO ATTIVITA' PRODUTTIVE: DIVIETO DI TRANSITO E DI SOSTA CON RIMOZIONE COATTA IN CORSO BETTINI, IN VIALE TRENTO E NELLE STRADE LIMITROFE A ROVERETO PER LO SVOLGIMENTO DEL MERCATO SETTIMANALE DEL MARTEDI'.",
      "from":1372543200000,
      "to":1378764000000,
      "creatorId":"default",
      "creatorType":"SERVICE",
      "effect":"Temporanea",
      "note":null
   },
   ...
]

Taxi stations info

The method allows for retrieving the list of taxi stations.

Request

GET /core.mobility/getTaxiStation/ HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

Response (list of Taxi stop structures)

[
   {
    "id": "via Degasperi 77@TAXI_TRENTO",
    "stationId": {
      "agencyId": "TAXI_TRENTO",
      "id": "via Degasperi 77",
      "extra": null
    },
    "type": "TAXI",
    "fullName": null,
    "location": [
      46.044135,
      11.129531
    ],
    "taxis": 0,
    "monitored": false,
    "address": "via Degasperi 77"
  },
   ...
]

Taxi contacts info

The method allows for retrieving the taxi contact information for different taxy agencies.

Request

GET /core.mobility/getTaxiAgencyContacts/ HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

Response (list of Taxi contacts structures)

[
   {
    "id": "Cooperativa",
    "name": "Cooperativa Radio Taxi",
    "agencyId": "TAXI_TRENTO",
    "phone": [
      "0461930002"
    ],
    "sms": [
      "3409949655"
    ]
  },,
   ...
]

Real-time Updates REST API

The requests are emitted to the following endpoint:

https://dev.smartcommunitylab.it/core.mobility

Signal alert as user

The method allows for signalling an arbitrary alert (delay, strike, accident, road work, parking availability) as a user.

Permission

mobilityservice.user.alert

Parameters

  • request body: the alert structure

Request

POST /core.mobility/alert/user HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user access token}

{
   "position":{
      "lon":"11.100248",
      "stopId":{
         "id":"22500c",
         "agencyId":"12"
      },
      "name":"RONCAFORT nord",
      "stopCode":"22500c",
      "lat":"46.103456"
   },
   "id":"71d6a009-dec9-4e1b-bd3b-d69ca65826e4",
   "to":1377094660792,
   "effect":"effect",
   "transport":{
      "tripId":"01-Feriale_036",
      "routeShortName":"01",
      "routeId":"01",
      "type":"BUS",
      "agencyId":"12"
   },
   "description":"description",
   "creatorId":"1",
   "delay":300000,
   "creatorType":"USER",
   "from":1377094360792,
   "type":"DELAY",
   "note":"note"
}

Response: empty

Signal alert as service provider

The method allows for signalling an arbitrary alert (delay, strike, accident, road work, parking availability) as a service provider.

Permission

mobilityservice.service.alert

Parameters

  • request body: the alert structure

Request

POST /core.mobility/alert/service HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {client access token}

{
   "position":{
      "lon":"11.100248",
      "stopId":{
         "id":"22500c",
         "agencyId":"12"
      },
      "name":"RONCAFORT nord",
      "stopCode":"22500c",
      "lat":"46.103456"
   },
   "id":"71d6a009-dec9-4e1b-bd3b-d69ca65826e4",
   "to":1377094660792,
   "effect":"effect",
   "transport":{
      "tripId":"01-Feriale_036",
      "routeShortName":"01",
      "routeId":"01",
      "type":"BUS",
      "agencyId":"12"
   },
   "description":"description",
   "creatorId":"1",
   "delay":300000,
   "creatorType":"USER",
   "from":1377094360792,
   "type":"DELAY",
   "note":"note"
}

Response: empty


Route Planning REST API

The requests are emitted to the following endpoint:

https://dev.smartcommunitylab.it/core.mobility

Plan a single journey

The method allows for planning journey given the input requirements (SingleJourney structure).

Parameters

  • request body: the SingleJourney structure

Request

POST /core.mobility/plansinglejourney HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

{
   "to":{
      "lon":"11.11889",
      "stopId":null,
      "name":null,
      "stopCode":null,
      "lat":"46.066695"
   },
   "routeType":"fastest",
   "resultsNumber":1,
   "departureTime":"04:25PM",
   "from":{
      "lon":"11.151796",
      "stopId":null,
      "name":null,
      "stopCode":null,
      "lat":"46.066799"
   },
   "date":"08/21/2013",
   "transportTypes":[
      "TRANSIT",
      "BICYCLE"
   ]
}

Response (list of Itinerary objects)

[
   {
      "from":{
         "name":"service road",
         "stopId":{
            "agencyId":"",
            "id":""
         },
         "stopCode":"null",
         "lon":"11.151824063634374",
         "lat":"46.06679860551396"
      },
      "to":{
         "name":"corner of path and sidewalk",
         "stopId":{
            "agencyId":"",
            "id":""
         },
         "stopCode":"null",
         "lon":"11.11889",
         "lat":"46.066695"
      },
      "startime":1377095100000,
      "endtime":1377096112000,
      "duration":1012000,
      "walkingDuration":1012,
      "leg":[
         {
            "legId":"null_null",
            "startime":1377095100000,
            "endtime":1377095716000,
            "duration":616000,
            "from":{
               "name":"service road",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.151824063634374",
               "lat":"46.06679860551396"
            },
            "to":{
               "name":"Via Benedetto Giovanelli",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.1311699",
               "lat":"46.0642586"
            },
            "transport":{
               "type":"BICYCLE",
               "agencyId":"null",
               "routeId":"null",
               "routeShortName":"null",
               "tripId":"null"
            },
            "legGeometery":{
               "length":107,
               "levels":"null",
               "points":"mldxG{aacAoAAg@ZCpCCx@?b@QA?dAExA@j@Bp@Jl@Tb@Xh@ZPV^Ll@HfAFNl@F^@LbADfAA^[~@WbAOx@Gl@@~@Dj@Lt@Pj@HX@`B?\\?dA?n@Hn@JZHHHX@F?DUACFIp@E^Ih@KPKHKTG^S|@Kl@M|AAPKNQj@Mt@E^Af@?f@FBD@CFIVKNBJFT?xACt@E`@INYBEH@J`@j@F@HEjA}@J@?Pe@vA@\\DV^R`@f@fA^bAdBRTx@VXRV\\JTFHF~D?dAGz@^Dt@Pp@PZhBJjB@V@hBK|BAR"
            },
            "alertStrikeList":[],
            "alertDelayList":[],
            "alertParkingList":[],
            "alertRoadList":[],
            "alertAccidentList":[]
         },
         {
            "legId":"null_null",
            "startime":1377095716000,
            "endtime":1377095722000,
            "duration":6000,
            "from":{
               "name":"Via Benedetto Giovanelli",
               "stopId":{
                  "agencyId":"",
                  "id":""
               },
               "stopCode":"null",
               "lon":"11.1311791",
               "lat":"46.0643067"
            },
            "to":{
               "name":"Via Fiume",
               "stopId":{
                  "agencyId":"",
                  "id":""
               },
               "stopCode":"null",
               "lon":"11.1311967",
               "lat":"46.0640542"
            },
            "transport":{
               "type":"WALK",
               "agencyId":"null",
               "routeId":"null",
               "routeShortName":"null",
               "tripId":"null"
            },
            "legGeometery":{
               "length":2,
               "levels":"null",
               "points":"{|cxGy`}bAH@"
            },
            "
            "alertStrikeList":[],
            "alertDelayList":[],
            "alertParkingList":[],
            "alertRoadList":[],
            "alertAccidentList":[]
         },
         {
            "legId":"null_null",
            "startime":1377095722000,
            "endtime":1377096112000,
            "duration":390000,
            "from":{
               "name":"Via Fiume",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.1311699",
               "lat":"46.0642586"
            },
            "to":{
               "name":"corner of path and sidewalk",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.11889",
               "lat":"46.066695"
            },
            "transport":{
               "type":"BICYCLE",
               "agencyId":"null",
               "routeId":"null",
               "routeShortName":"null",
               "tripId":"null"
            },
            "legGeometery":{
               "length":39,
               "levels":"null",
               "points":"q|cxGw`}bAf@ENHLRBJBN?BOvAIjAg@nFa@|DIPyA|OIbAEV[lG?N@NBVETUBG@{@jICLAH]@g@?Y?b@hJG?IAQBE?E@}AR@TOB@b@I@"
            },
            "alertStrikeList":[],
            "alertDelayList":[],
            "alertParkingList":[],
            "alertRoadList":[],
            "alertAccidentList":[]
         }
      ]
   }
   ,
   ...
]

Plan a recurrent journey

The method allows for planning a recurrent journey given the input requirements (RecurrentJourneyParameters structure).

Parameters

  • request body: the RecurrentJourneyParameters structure

Request

POST /core.mobility/planrecurrent HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user or client access token}

{
   "to":{
      "lon":"11.11889",
      "stopId":null,
      "name":null,
      "stopCode":null,
      "lat":"46.066695"
   },
   "time":"04:30PM",
   "routeType":"fastest",
   "recurrence":[
      1,
      2,
      3,
      4,
      5,
      6,
      7
   ],
   "interval":3600000,
   "fromDate":1377095453280,
   "resultsNumber":3,
   "from":{
      "lon":"11.151796",
      "stopId":null,
      "name":null,
      "stopCode":null,
      "lat":"46.066799"
   },
   "toDate":1377700254728,
   "transportTypes":[
      "TRANSIT",
      "BICYCLE"
   ]
}

Response (RecurrentJourney structure)

{
   "parameters":{
      "recurrence":[
         1,
         2,
         3,
         4,
         5,
         6,
         7
      ],
      "from":{
         "name":null,
         "stopId":null,
         "stopCode":null,
         "lon":"11.151796",
         "lat":"46.066799"
      },
      "to":{
         "name":null,
         "stopId":null,
         "stopCode":null,
         "lon":"11.11889",
         "lat":"46.066695"
      },
      "fromDate":1377095453280,
      "toDate":1377700254728,
      "time":"04:30PM",
      "interval":3600000,
      "transportTypes":[
         "TRANSIT",
         "BICYCLE"
      ],
      "routeType":"fastest",
      "resultsNumber":3
   },
   "legs":[
      {
         "from":"POVO  \"Fac. Scienze\"",
         "to":"Piazza Dante  Dogana",
         "transport":{
            "type":"BUS",
            "agencyId":"12",
            "routeId":"05R",
            "routeShortName":"5",
            "tripId":"05R-Feriale_045"
         }
      },
      {
         "from":"Piazza Dante  \"Stazione FS\"",
         "to":"Rosmini  S.Maria Maggiore",
         "transport":{
            "type":"BUS",
            "agencyId":"12",
            "routeId":"09A",
            "routeShortName":"9",
            "tripId":"09A-Feriale_032"
         }
      },
      {
         "from":"POVO  \"Fac. Scienze\"",
         "to":"Piazza Dante  Dogana",
         "transport":{
            "type":"BUS",
            "agencyId":"12",
            "routeId":"05R",
            "routeShortName":"5",
            "tripId":"05R-Feriale_047"
         }
      },
      {
         "from":"Piazza Dante  \"Stazione FS\"",
         "to":"Rosmini  S.Maria Maggiore",
         "transport":{
            "type":"BUS",
            "agencyId":"12",
            "routeId":"09A",
            "routeShortName":"9",
            "tripId":"09A-Feriale_033"
         }
      },
      {
         "from":"POVO  \"Fac. Scienze\"",
         "to":"Piazza Dante  Dogana",
         "transport":{
            "type":"BUS",
            "agencyId":"12",
            "routeId":"05R",
            "routeShortName":"5",
            "tripId":"05R-Feriale_049"
         }
      },
      {
         "from":"Povo Mesiano FS",
         "to":"Trento FS",
         "transport":{
            "type":"TRAIN",
            "agencyId":"6",
            "routeId":"TB_R2_R",
            "routeShortName":"RG",
            "tripId":"R5840"
         }
      },
      {
         "from":"Piazza Dante  \"Stazione FS\"",
         "to":"Rosmini  S.Maria Maggiore",
         "transport":{
            "type":"BUS",
            "agencyId":"12",
            "routeId":"05A",
            "routeShortName":"5",
            "tripId":"05A-Feriale_056"
         }
      },
      {
         "from":"POVO  Piazza Manci",
         "to":"Rosmini  \"Cimitero\"",
         "transport":{
            "type":"BUS",
            "agencyId":"12",
            "routeId":"13R",
            "routeShortName":"13",
            "tripId":"13R-Feriale_021"
         }
      },
      {
         "from":"Povo-Mesiano (Stazione F.S.)",
         "to":"Trento (Stazione Fs)",
         "transport":{
            "type":"BUS",
            "agencyId":"17",
            "routeId":"521_ExUr",
            "routeShortName":"401",
            "tripId":"0001129442011062520110910"
         }
      },
      {
         "from":"service road",
         "to":"Via Benedetto Giovanelli",
         "transport":{
            "type":"BICYCLE",
            "agencyId":"null",
            "routeId":"null",
            "routeShortName":"null",
            "tripId":"null"
         }
      }
   ],
   "monitorLegs":{
      "12_05A":true,
      "12_05R":true,
      "12_09A":true,
      "12_13R":true,
      "17_521_ExUr":true,
      "6_TB_R2_R":true
   }
}

User Routes REST API

The requests are emitted to the following endpoint:

https://dev.smartcommunitylab.it/core.mobility

Save single journey

The method allows the user to store a single journey for, e.g., monitoring purposes.

Permission

mobilityservice.user.itinerary.write

Parameters

  • request body: BasicJourney data structure with itinerary to store

Request

POST /core.mobility/itinerary HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user access token}

{
   "monitor":true,
   "originalTo":{
      "lon":"11.11889",
      "stopId":null,
      "name":null,
      "stopCode":null,
      "lat":"46.066695"
   },
   "name":"test",
   "data":{
      "to":{
         "lon":"11.11889",
         "stopId":{
            "id":"",
            "agencyId":""
         },
         "name":"corner of path and sidewalk",
         "stopCode":"null",
         "lat":"46.066695"
      },
      "endtime":1377099352000,
      "leg":[
         {
            "to":{
               "lon":"11.1311699",
               "stopId":null,
               "name":"Via Benedetto Giovanelli",
               "stopCode":"null",
               "lat":"46.0642586"
            },
            "endtime":1377098956000,
            "alertParkingList":[

            ],
            "duration":616000,
            "startime":1377098340000,
            "transport":{
               "tripId":"null",
               "routeShortName":"null",
               "routeId":"null",
               "type":"BICYCLE",
               "agencyId":"null"
            },
            "alertDelayList":[

            ],
            "alertStrikeList":[

            ],
            "from":{
               "lon":"11.151824063634374",
               "stopId":null,
               "name":"service road",
               "stopCode":"null",
               "lat":"46.06679860551396"
            },
            "legGeometery":{
               "levels":"null",
               "length":107,
               "points":"mldxG{aacAoAAg@ZCpCCx@?b@QA?dAExA@j@Bp@Jl@Tb@Xh@ZPV^Ll@HfAFNl@F^@LbADfAA^[~@WbAOx@Gl@@~@Dj@Lt@Pj@HX@`B?\\?dA?n@Hn@JZHHHX@F?DUACFIp@E^Ih@KPKHKTG^S|@Kl@M|AAPKNQj@Mt@E^Af@?f@FBD@CFIVKNBJFT?xACt@E`@INYBEH@J`@j@F@HEjA}@J@?Pe@vA@\\DV^R`@f@fA^bAdBRTx@VXRV\\JTFHF~D?dAGz@^Dt@Pp@PZhBJjB@V@hBK|BAR"
            },
            "legId":"null_null"
         },
         {
            "to":{
               "lon":"11.1311967",
               "stopId":{
                  "id":"",
                  "agencyId":""
               },
               "name":"Via Fiume",
               "stopCode":"null",
               "lat":"46.0640542"
            },
            "endtime":1377098962000,
            "alertParkingList":[

            ],
            "duration":6000,
            "startime":1377098956000,
            "transport":{
               "tripId":"null",
               "routeShortName":"null",
               "routeId":"null",
               "type":"WALK",
               "agencyId":"null"
            },
            "alertDelayList":[

            ],
            "alertStrikeList":[

            ],
            "from":{
               "lon":"11.1311791",
               "stopId":{
                  "id":"",
                  "agencyId":""
               },
               "name":"Via Benedetto Giovanelli",
               "stopCode":"null",
               "lat":"46.0643067"
            },
            "legGeometery":{
               "levels":"null",
               "length":2,
               "points":"{|cxGy`}bAH@"
            },
            "legId":"null_null"
         },
         {
            "to":{
               "lon":"11.11889",
               "stopId":null,
               "name":"corner of path and sidewalk",
               "stopCode":"null",
               "lat":"46.066695"
            },
            "endtime":1377099352000,
            "alertParkingList":[

            ],
            "duration":390000,
            "startime":1377098962000,
            "transport":{
               "tripId":"null",
               "routeShortName":"null",
               "routeId":"null",
               "type":"BICYCLE",
               "agencyId":"null"
            },
            "alertDelayList":[

            ],
            "alertStrikeList":[

            ],
            "from":{
               "lon":"11.1311699",
               "stopId":null,
               "name":"Via Fiume",
               "stopCode":"null",
               "lat":"46.0642586"
            },
            "legGeometery":{
               "levels":"null",
               "length":39,
               "points":"q|cxGw`}bAf@ENHLRBJBN?BOvAIjAg@nFa@|DIPyA|OIbAEV[lG?N@NBVETUBG@{@jICLAH]@g@?Y?b@hJG?IAQBE?E@}AR@TOB@b@I@"
            },
            "legId":"null_null"
         }
      ],
      "duration":1012000,
      "startime":1377098340000,
      "walkingDuration":1012,
      "from":{
         "lon":"11.151824063634374",
         "stopId":{
            "id":"",
            "agencyId":""
         },
         "name":"service road",
         "stopCode":"null",
         "lat":"46.06679860551396"
      }
   },
   "originalFrom":{
      "lon":"11.151796",
      "stopId":null,
      "name":null,
      "stopCode":null,
      "lat":"46.066799"
   }
}

Response (saved BasicJourney structure)

{
   "clientId":"5214daa4975a4023840002a2",
   "data":{
      "from":{
         "name":"service road",
         "stopId":{
            "agencyId":"",
            "id":""
         },
         "stopCode":"null",
         "lon":"11.151824063634374",
         "lat":"46.06679860551396"
      },
      "to":{
         "name":"corner of path and sidewalk",
         "stopId":{
            "agencyId":"",
            "id":""
         },
         "stopCode":"null",
         "lon":"11.11889",
         "lat":"46.066695"
      },
      "startime":1377098340000,
      "endtime":1377099352000,
      "duration":1012000,
      "walkingDuration":1012,
      "leg":[
         {
            "legId":"null_null",
            "startime":1377098340000,
            "endtime":1377098956000,
            "duration":616000,
            "from":{
               "name":"service road",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.151824063634374",
               "lat":"46.06679860551396"
            },
            "to":{
               "name":"Via Benedetto Giovanelli",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.1311699",
               "lat":"46.0642586"
            },
            "transport":{
               "type":"BICYCLE",
               "agencyId":"null",
               "routeId":"null",
               "routeShortName":"null",
               "tripId":"null"
            },
            "legGeometery":{
               "length":107,
               "levels":"null",
               "points":"mldxG{aacAoAAg@ZCpCCx@?b@QA?dAExA@j@Bp@Jl@Tb@Xh@ZPV^Ll@HfAFNl@F^@LbADfAA^[~@WbAOx@Gl@@~@Dj@Lt@Pj@HX@`B?\\?dA?n@Hn@JZHHHX@F?DUACFIp@E^Ih@KPKHKTG^S|@Kl@M|AAPKNQj@Mt@E^Af@?f@FBD@CFIVKNBJFT?xACt@E`@INYBEH@J`@j@F@HEjA}@J@?Pe@vA@\\DV^R`@f@fA^bAdBRTx@VXRV\\JTFHF~D?dAGz@^Dt@Pp@PZhBJjB@V@hBK|BAR"
            },
            "alertStrikeList":[

            ],
            "alertDelayList":[

            ],
            "alertParkingList":[

            ],
            "alertRoadList":null,
            "alertAccidentList":null
         },
         {
            "legId":"null_null",
            "startime":1377098956000,
            "endtime":1377098962000,
            "duration":6000,
            "from":{
               "name":"Via Benedetto Giovanelli",
               "stopId":{
                  "agencyId":"",
                  "id":""
               },
               "stopCode":"null",
               "lon":"11.1311791",
               "lat":"46.0643067"
            },
            "to":{
               "name":"Via Fiume",
               "stopId":{
                  "agencyId":"",
                  "id":""
               },
               "stopCode":"null",
               "lon":"11.1311967",
               "lat":"46.0640542"
            },
            "transport":{
               "type":"WALK",
               "agencyId":"null",
               "routeId":"null",
               "routeShortName":"null",
               "tripId":"null"
            },
            "legGeometery":{
               "length":2,
               "levels":"null",
               "points":"{|cxGy`}bAH@"
            },
            "alertStrikeList":[

            ],
            "alertDelayList":[

            ],
            "alertParkingList":[

            ],
            "alertRoadList":null,
            "alertAccidentList":null
         },
         {
            "legId":"null_null",
            "startime":1377098962000,
            "endtime":1377099352000,
            "duration":390000,
            "from":{
               "name":"Via Fiume",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.1311699",
               "lat":"46.0642586"
            },
            "to":{
               "name":"corner of path and sidewalk",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.11889",
               "lat":"46.066695"
            },
            "transport":{
               "type":"BICYCLE",
               "agencyId":"null",
               "routeId":"null",
               "routeShortName":"null",
               "tripId":"null"
            },
            "legGeometery":{
               "length":39,
               "levels":"null",
               "points":"q|cxGw`}bAf@ENHLRBJBN?BOvAIjAg@nFa@|DIPyA|OIbAEV[lG?N@NBVETUBG@{@jICLAH]@g@?Y?b@hJG?IAQBE?E@}AR@TOB@b@I@"
            },
            "alertStrikeList":[

            ],
            "alertDelayList":[

            ],
            "alertParkingList":[

            ],
            "alertRoadList":null,
            "alertAccidentList":null
         }
      ]
   },
   "monitor":true,
   "originalFrom":{
      "name":null,
      "stopId":null,
      "stopCode":null,
      "lon":"11.151796",
      "lat":"46.066799"
   },
   "originalTo":{
      "name":null,
      "stopId":null,
      "stopCode":null,
      "lon":"11.11889",
      "lat":"46.066695"
   },
   "name":"test"
}

Read single journey

The method allows the user to read a single journey stored by the user.

Permission

mobilityservice.user.itinerary.read

Parameters

  • id (path variable): stored journey ID

Request

GET /core.mobility/itinerary/{id} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user access token}

Response (saved BasicJourney structure)

{
   "clientId":"5214daa4975a4023840002a2",
   "data":{
      "from":{
         "name":"service road",
         "stopId":{
            "agencyId":"",
            "id":""
         },
         "stopCode":"null",
         "lon":"11.151824063634374",
         "lat":"46.06679860551396"
      },
      "to":{
         "name":"corner of path and sidewalk",
         "stopId":{
            "agencyId":"",
            "id":""
         },
         "stopCode":"null",
         "lon":"11.11889",
         "lat":"46.066695"
      },
      "startime":1377098340000,
      "endtime":1377099352000,
      "duration":1012000,
      "walkingDuration":1012,
      "leg":[
         {
            "legId":"null_null",
            "startime":1377098340000,
            "endtime":1377098956000,
            "duration":616000,
            "from":{
               "name":"service road",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.151824063634374",
               "lat":"46.06679860551396"
            },
            "to":{
               "name":"Via Benedetto Giovanelli",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.1311699",
               "lat":"46.0642586"
            },
            "transport":{
               "type":"BICYCLE",
               "agencyId":"null",
               "routeId":"null",
               "routeShortName":"null",
               "tripId":"null"
            },
            "legGeometery":{
               "length":107,
               "levels":"null",
               "points":"mldxG{aacAoAAg@ZCpCCx@?b@QA?dAExA@j@Bp@Jl@Tb@Xh@ZPV^Ll@HfAFNl@F^@LbADfAA^[~@WbAOx@Gl@@~@Dj@Lt@Pj@HX@`B?\\?dA?n@Hn@JZHHHX@F?DUACFIp@E^Ih@KPKHKTG^S|@Kl@M|AAPKNQj@Mt@E^Af@?f@FBD@CFIVKNBJFT?xACt@E`@INYBEH@J`@j@F@HEjA}@J@?Pe@vA@\\DV^R`@f@fA^bAdBRTx@VXRV\\JTFHF~D?dAGz@^Dt@Pp@PZhBJjB@V@hBK|BAR"
            },
            "alertStrikeList":[

            ],
            "alertDelayList":[

            ],
            "alertParkingList":[

            ],
            "alertRoadList":null,
            "alertAccidentList":null
         },
         {
            "legId":"null_null",
            "startime":1377098956000,
            "endtime":1377098962000,
            "duration":6000,
            "from":{
               "name":"Via Benedetto Giovanelli",
               "stopId":{
                  "agencyId":"",
                  "id":""
               },
               "stopCode":"null",
               "lon":"11.1311791",
               "lat":"46.0643067"
            },
            "to":{
               "name":"Via Fiume",
               "stopId":{
                  "agencyId":"",
                  "id":""
               },
               "stopCode":"null",
               "lon":"11.1311967",
               "lat":"46.0640542"
            },
            "transport":{
               "type":"WALK",
               "agencyId":"null",
               "routeId":"null",
               "routeShortName":"null",
               "tripId":"null"
            },
            "legGeometery":{
               "length":2,
               "levels":"null",
               "points":"{|cxGy`}bAH@"
            },
            "alertStrikeList":[

            ],
            "alertDelayList":[

            ],
            "alertParkingList":[

            ],
            "alertRoadList":null,
            "alertAccidentList":null
         },
         {
            "legId":"null_null",
            "startime":1377098962000,
            "endtime":1377099352000,
            "duration":390000,
            "from":{
               "name":"Via Fiume",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.1311699",
               "lat":"46.0642586"
            },
            "to":{
               "name":"corner of path and sidewalk",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.11889",
               "lat":"46.066695"
            },
            "transport":{
               "type":"BICYCLE",
               "agencyId":"null",
               "routeId":"null",
               "routeShortName":"null",
               "tripId":"null"
            },
            "legGeometery":{
               "length":39,
               "levels":"null",
               "points":"q|cxGw`}bAf@ENHLRBJBN?BOvAIjAg@nFa@|DIPyA|OIbAEV[lG?N@NBVETUBG@{@jICLAH]@g@?Y?b@hJG?IAQBE?E@}AR@TOB@b@I@"
            },
            "alertStrikeList":[

            ],
            "alertDelayList":[

            ],
            "alertParkingList":[

            ],
            "alertRoadList":null,
            "alertAccidentList":null
         }
      ]
   },
   "monitor":true,
   "originalFrom":{
      "name":null,
      "stopId":null,
      "stopCode":null,
      "lon":"11.151796",
      "lat":"46.066799"
   },
   "originalTo":{
      "name":null,
      "stopId":null,
      "stopCode":null,
      "lon":"11.11889",
      "lat":"46.066695"
   },
   "name":"test"
}

Read all single journeys

The method allows the user to read all single journeys stored by the user.

Permission

mobilityservice.user.itinerary.read

Request

GET /core.mobility/itinerary HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user access token}

Response (list of saved BasicJourney structures)

[
{
   "clientId":"5214daa4975a4023840002a2",
   "data":{
      "from":{
         "name":"service road",
         "stopId":{
            "agencyId":"",
            "id":""
         },
         "stopCode":"null",
         "lon":"11.151824063634374",
         "lat":"46.06679860551396"
      },
      "to":{
         "name":"corner of path and sidewalk",
         "stopId":{
            "agencyId":"",
            "id":""
         },
         "stopCode":"null",
         "lon":"11.11889",
         "lat":"46.066695"
      },
      "startime":1377098340000,
      "endtime":1377099352000,
      "duration":1012000,
      "walkingDuration":1012,
      "leg":[
         {
            "legId":"null_null",
            "startime":1377098340000,
            "endtime":1377098956000,
            "duration":616000,
            "from":{
               "name":"service road",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.151824063634374",
               "lat":"46.06679860551396"
            },
            "to":{
               "name":"Via Benedetto Giovanelli",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.1311699",
               "lat":"46.0642586"
            },
            "transport":{
               "type":"BICYCLE",
               "agencyId":"null",
               "routeId":"null",
               "routeShortName":"null",
               "tripId":"null"
            },
            "legGeometery":{
               "length":107,
               "levels":"null",
               "points":"mldxG{aacAoAAg@ZCpCCx@?b@QA?dAExA@j@Bp@Jl@Tb@Xh@ZPV^Ll@HfAFNl@F^@LbADfAA^[~@WbAOx@Gl@@~@Dj@Lt@Pj@HX@`B?\\?dA?n@Hn@JZHHHX@F?DUACFIp@E^Ih@KPKHKTG^S|@Kl@M|AAPKNQj@Mt@E^Af@?f@FBD@CFIVKNBJFT?xACt@E`@INYBEH@J`@j@F@HEjA}@J@?Pe@vA@\\DV^R`@f@fA^bAdBRTx@VXRV\\JTFHF~D?dAGz@^Dt@Pp@PZhBJjB@V@hBK|BAR"
            },
            "alertStrikeList":[

            ],
            "alertDelayList":[

            ],
            "alertParkingList":[

            ],
            "alertRoadList":null,
            "alertAccidentList":null
         },
         {
            "legId":"null_null",
            "startime":1377098956000,
            "endtime":1377098962000,
            "duration":6000,
            "from":{
               "name":"Via Benedetto Giovanelli",
               "stopId":{
                  "agencyId":"",
                  "id":""
               },
               "stopCode":"null",
               "lon":"11.1311791",
               "lat":"46.0643067"
            },
            "to":{
               "name":"Via Fiume",
               "stopId":{
                  "agencyId":"",
                  "id":""
               },
               "stopCode":"null",
               "lon":"11.1311967",
               "lat":"46.0640542"
            },
            "transport":{
               "type":"WALK",
               "agencyId":"null",
               "routeId":"null",
               "routeShortName":"null",
               "tripId":"null"
            },
            "legGeometery":{
               "length":2,
               "levels":"null",
               "points":"{|cxGy`}bAH@"
            },
            "alertStrikeList":[

            ],
            "alertDelayList":[

            ],
            "alertParkingList":[

            ],
            "alertRoadList":null,
            "alertAccidentList":null
         },
         {
            "legId":"null_null",
            "startime":1377098962000,
            "endtime":1377099352000,
            "duration":390000,
            "from":{
               "name":"Via Fiume",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.1311699",
               "lat":"46.0642586"
            },
            "to":{
               "name":"corner of path and sidewalk",
               "stopId":null,
               "stopCode":"null",
               "lon":"11.11889",
               "lat":"46.066695"
            },
            "transport":{
               "type":"BICYCLE",
               "agencyId":"null",
               "routeId":"null",
               "routeShortName":"null",
               "tripId":"null"
            },
            "legGeometery":{
               "length":39,
               "levels":"null",
               "points":"q|cxGw`}bAf@ENHLRBJBN?BOvAIjAg@nFa@|DIPyA|OIbAEV[lG?N@NBVETUBG@{@jICLAH]@g@?Y?b@hJG?IAQBE?E@}AR@TOB@b@I@"
            },
            "alertStrikeList":[

            ],
            "alertDelayList":[

            ],
            "alertParkingList":[

            ],
            "alertRoadList":null,
            "alertAccidentList":null
         }
      ]
   },
   "monitor":true,
   "originalFrom":{
      "name":null,
      "stopId":null,
      "stopCode":null,
      "lon":"11.151796",
      "lat":"46.066799"
   },
   "originalTo":{
      "name":null,
      "stopId":null,
      "stopCode":null,
      "lon":"11.11889",
      "lat":"46.066695"
   },
   "name":"test"
},
...
]

Monitor single journey

The method allows the user to switch journey monitoring on/off.

Permission

mobilityservice.user.itinerary.write

Parameters

  • id (path variable): stored journey ID
  • monitor (path variable): monitoring status to be sete

Request

GET /core.mobility/itinerary/{id}/monitor/{monitor} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user access token}

Response: monitoring status

true

Delete single journey

The method allows the user to delete saved journey.

Permission

mobilityservice.user.itinerary.write

Parameters

  • id (path variable): stored journey ID

Request

DELETE /core.mobility/itinerary/{id} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user access token}

Response: result of the operation

true

Save recurrent journey

The method allows the user to store a recurrent journey for, e.g., monitoring purposes.

Permission

mobilityservice.user.itinerary.write

Parameters

  • request body: BasicRecurrentJourney data structure to store

Request

POST /core.mobility/recurrent HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user access token}

{
   "monitor":true,
   "name":"test",
   "data":{
      "monitorLegs":{
         "12_16R":true,
         "12_13R":true,
         "17_521_ExUr":true,
         "12_03A":true,
         "12_05A":true,
         "12_04A":true,
         "12_09A":true,
         "12_01":true,
         "12_09R":true,
         "6_TB_R2_R":true,
         "12_05R":true
      },
      "legs":[
         {
            "to":"Piazza Dante  Dogana",
            "transport":{
               "tripId":"05R-Feriale_051",
               "routeShortName":"5",
               "routeId":"05R",
               "type":"BUS",
               "agencyId":"12"
            },
            "from":"POVO  \"Fac. Scienze\""
         },
         ...
      ],
      "parameters":{
         "to":{
            "lon":"11.11889",
            "stopId":null,
            "name":"null",
            "stopCode":"null",
            "lat":"46.066695"
         },
         "time":"05:31PM",
         "routeType":"fastest",
         "recurrence":[
            1,
            2,
            3,
            4,
            5,
            6,
            7
         ],
         "interval":3600000,
         "fromDate":1377099062591,
         "resultsNumber":3,
         "from":{
            "lon":"11.151796",
            "stopId":null,
            "name":"null",
            "stopCode":"null",
            "lat":"46.066799"
         },
         "toDate":1377703862597,
         "transportTypes":[
            "TRANSIT",
            "BICYCLE"
         ]
      }
   }
}

Response (saved BasicRecurrentJourney structure)

{
   "clientId":"5214e671975a4023840002a8",
   "data":{
      "parameters":{
         "recurrence":[
            1,
            2,
            3,
            4,
            5,
            6,
            7
         ],
         "from":{
            "name":"null",
            "stopId":null,
            "stopCode":"null",
            "lon":"11.151796",
            "lat":"46.066799"
         },
         "to":{
            "name":"null",
            "stopId":null,
            "stopCode":"null",
            "lon":"11.11889",
            "lat":"46.066695"
         },
         "fromDate":1377101418001,
         "toDate":1377706218008,
         "time":"06:10PM",
         "interval":3600000,
         "transportTypes":[
            "TRANSIT",
            "BICYCLE"
         ],
         "routeType":"fastest",
         "resultsNumber":3
      },
      "legs":[
         {
            "from":"POVO  \"Fac. Scienze\"",
            "to":"Piazza Dante  Dogana",
            "transport":{
               "type":"BUS",
               "agencyId":"12",
               "routeId":"05R",
               "routeShortName":"5",
               "tripId":"05R-Feriale_055"
            }
         },
         ...
      ],
      "monitorLegs":{
         "12_16R":true,
         "12_13R":true,
         "17_521_ExUr":true,
         "12_12A":true,
         "12_05A":true,
         "12_09A":true,
         "12_01":true,
         "12_09R":true,
         "6_TB_R2_R":true,
         "12_05R":true
      }
   },
   "name":"test",
   "monitor":true
}

Read recurrent journey

The method allows the user to read a recurrent journey stored by the user.

Permission

mobilityservice.user.itinerary.read

Parameters

  • id (path variable): stored journey ID

Request

GET /core.mobility/recurrent/{id} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user access token}

Response (saved BasicRecurrentJourney structure)

{
   "clientId":"5214e671975a4023840002a8",
   "data":{
      "parameters":{
         "recurrence":[
            1,
            2,
            3,
            4,
            5,
            6,
            7
         ],
         "from":{
            "name":"null",
            "stopId":null,
            "stopCode":"null",
            "lon":"11.151796",
            "lat":"46.066799"
         },
         "to":{
            "name":"null",
            "stopId":null,
            "stopCode":"null",
            "lon":"11.11889",
            "lat":"46.066695"
         },
         "fromDate":1377101418001,
         "toDate":1377706218008,
         "time":"06:10PM",
         "interval":3600000,
         "transportTypes":[
            "TRANSIT",
            "BICYCLE"
         ],
         "routeType":"fastest",
         "resultsNumber":3
      },
      "legs":[
         {
            "from":"POVO  \"Fac. Scienze\"",
            "to":"Piazza Dante  Dogana",
            "transport":{
               "type":"BUS",
               "agencyId":"12",
               "routeId":"05R",
               "routeShortName":"5",
               "tripId":"05R-Feriale_055"
            }
         },
         ...
      ],
      "monitorLegs":{
         "12_16R":true,
         "12_13R":true,
         "17_521_ExUr":true,
         "12_12A":true,
         "12_05A":true,
         "12_09A":true,
         "12_01":true,
         "12_09R":true,
         "6_TB_R2_R":true,
         "12_05R":true
      }
   },
   "name":"test",
   "monitor":true
}

Read all recurrent journeys

The method allows the user to read all recurrent journeys stored by the user.

Permission

mobilityservice.user.itinerary.read

Request

GET /core.mobility/recurrent HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user access token}

Response (list of saved BasicRecurrentJourney structures)

[
{
   "clientId":"5214e671975a4023840002a8",
   "data":{
      "parameters":{
         "recurrence":[
            1,
            2,
            3,
            4,
            5,
            6,
            7
         ],
         "from":{
            "name":"null",
            "stopId":null,
            "stopCode":"null",
            "lon":"11.151796",
            "lat":"46.066799"
         },
         "to":{
            "name":"null",
            "stopId":null,
            "stopCode":"null",
            "lon":"11.11889",
            "lat":"46.066695"
         },
         "fromDate":1377101418001,
         "toDate":1377706218008,
         "time":"06:10PM",
         "interval":3600000,
         "transportTypes":[
            "TRANSIT",
            "BICYCLE"
         ],
         "routeType":"fastest",
         "resultsNumber":3
      },
      "legs":[
         {
            "from":"POVO  \"Fac. Scienze\"",
            "to":"Piazza Dante  Dogana",
            "transport":{
               "type":"BUS",
               "agencyId":"12",
               "routeId":"05R",
               "routeShortName":"5",
               "tripId":"05R-Feriale_055"
            }
         },
         ...
      ],
      "monitorLegs":{
         "12_16R":true,
         "12_13R":true,
         "17_521_ExUr":true,
         "12_12A":true,
         "12_05A":true,
         "12_09A":true,
         "12_01":true,
         "12_09R":true,
         "6_TB_R2_R":true,
         "12_05R":true
      }
   },
   "name":"test",
   "monitor":true
},
...
]

Monitor recurrent journey

The method allows the user to switch recurrent journey monitoring on/off.

Permission

mobilityservice.user.itinerary.write

Parameters

  • id (path variable): stored journey ID
  • monitor (path variable): monitoring status to be sete

Request

GET /core.mobility/recurrent/{id}/monitor/{monitor} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user access token}

Response: monitoring status

true

Update recurrent journey

The method allows the user to update recurrent journey.

Permission

mobilityservice.user.itinerary.write

Parameters

  • id (path variable): stored journey ID
  • request body: recurrent journey to update

Request

PUT /core.mobility/recurrent/{id} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user access token}

{
   "clientId":"5214e671975a4023840002a8",
   "data":{
      "parameters":{
         "recurrence":[
            1,
            2,
            3,
            4,
            5,
            6,
            7
         ],
         "from":{
            "name":"null",
            "stopId":null,
            "stopCode":"null",
            "lon":"11.151796",
            "lat":"46.066799"
         },
         "to":{
            "name":"null",
            "stopId":null,
            "stopCode":"null",
            "lon":"11.11889",
            "lat":"46.066695"
         },
         "fromDate":1377101418001,
         "toDate":1377706218008,
         "time":"06:10PM",
         "interval":3600000,
         "transportTypes":[
            "TRANSIT",
            "BICYCLE"
         ],
         "routeType":"fastest",
         "resultsNumber":3
      },
      "legs":[
         {
            "from":"POVO  \"Fac. Scienze\"",
            "to":"Piazza Dante  Dogana",
            "transport":{
               "type":"BUS",
               "agencyId":"12",
               "routeId":"05R",
               "routeShortName":"5",
               "tripId":"05R-Feriale_055"
            }
         },
         ...
      ],
      "monitorLegs":{
         "12_16R":true,
         "12_13R":true,
         "17_521_ExUr":true,
         "12_12A":true,
         "12_05A":true,
         "12_09A":true,
         "12_01":true,
         "12_09R":true,
         "6_TB_R2_R":true,
         "12_05R":true
      }
   },
   "name":"test",
   "monitor":true
}

Response: result of the operation

true

Delete recurrent journey

The method allows the user to delete saved recurrent journey.

Permission

mobilityservice.user.itinerary.write

Parameters

  • id (path variable): stored journey ID

Request

DELETE /core.mobility/recurrent/{id} HTTPS/1.1
Host: dev.smartcommunitylab.it
Accept: application/json
Authorization: Bearer {user access token}

Response: result of the operation

true

Java Client Library

The Mobility Service client library provides an access to the operations exposed by the Mobility Service REST APIs.

The source code of the library is available at https://github.com/smartcommunitylab/mobilityservice.client.

To use the library, the Maven coordinates of the library are as follows:

	<dependency>
		<groupId>eu.trentorise.smartcampus</groupId>
		<artifactId>mobilityservice.client</artifactId>
		<version>1.1.6</version>
		<scope>jar</scope>
	</dependency>

Note that the SmartCommunity repository should be included in Maven configuration, e.g.:

    <repository>
      <id>SmartCommunity</id>
      <url>http://repository.smartcommunitylab.it/content/groups/public</url>
    </repository>

The functionality is exposed by the MobilityDataService (for transport information API) class, the MobilityAlertService (for signalling alerts), MobilityPlannerService (for planning functionality), and the MobilityUserService (for managing the user trips) class.

The following code demonstrates how the classes may be used:

MobilityDataService dataService = new MobilityDataService("https://dev.smartcommunitylab.it/core.mobility");
MobilityPlannerService plannerService = new MobilityPlannerService("https://dev.smartcommunitylab.it/core.mobility");
MobilityAlertService alertService = new MobilityAlertService("https://dev.smartcommunitylab.it/core.mobility");
MobilityUserService userService = new MobilityUserService("https://dev.smartcommunitylab.it/core.mobility");
 
// get route information, agency '12' (Trento city bus)
List<Route> routes = dataService.getRoutes("12","token");
// get stops information
//get stops information
List<Stop> stops = dataService.getStops("12",routes.get(0).getId().getId(), "token");
// stop times on the stop and route 
List<StopTime> stopTimes = dataService.getStopTimes("12",routes.get(0).getId().getId(),stops.get(0).getId(), "token");
// next trips at the stop
List<TripData> stopTrips = dataService.getNextTrips("12",stops.get(0).getId(), 3, "token");
// timetable for the route
TimeTable tt = dataService.getTimeTable(routes.get(0).getId().getId(), System.currentTimeMillis(), "token");
// delays for route
List<Delay> delays = dataService.getDelays(routes.get(0).getId().getId(), "token");
 
// get road works information for Rovereto for the next three days
List<AlertRoad> roadInfos = dataService.getRoadInfo("COMUNE_DI_ROVERETO", System.currentTimeMillis(), System.currentTimeMillis()+100*60*60*24*3,"token");
// get parkings in Trento
List<Parking> parkings = dataService.getParkings("COMUNE_DI_TRENTO","token");
 
// delay alert
AlertDelay ac = new AlertDelay();
ac.setDescription("description");
ac.setEffect("effect");
ac.setFrom(System.currentTimeMillis());
ac.setTo(System.currentTimeMillis()+1000*60*20); // valid for 20 mins
ac.setNote("note");
Stop s = stops.get(0);
ac.setPosition(new Position(s.getName(), new StopId("12", s.getId()), s.getId(), ""+s.getLongitude(), ""+s.getLatitude()));
ac.setDelay(60*1000*5);
// we need some trip to signal a delay
List<TripData> stopTrips = dataService.getNextTrips("12",stops.get(0).getId(), 3, "token");
ac.setTransport(new Transport(TType.BUS, "12", stopTrips.get(0).getRouteId(), stopTrips.get(0).getTripId()));
alertService.sendUserAlert(ac, "token");
 
// plan a single journey
SingleJourney request = new SingleJourney();
request.setDate(new SimpleDateFormat("MM/dd/yyyy").format(new Date()));
request.setDepartureTime(new SimpleDateFormat("hh:mmaa").format(new Date()));
Position from = new Position();
from.setLat("46.066799");
from.setLon("11.151796");
request.setFrom(from);
Position to = new Position("46.066695,11.11889");
request.setTo(to);
request.setResultsNumber(3);
request.setRouteType(RType.fastest);
request.setTransportTypes(new TType[]{TType.TRANSIT, TType.BICYCLE});
List<Itinerary> list = plannerService.planSingleJourney(request, "token");
 
// save the journey
BasicItinerary basic = new BasicItinerary();
basic.setData(list.get(0));
basic.setMonitor(true);
basic.setName("test");
basic.setOriginalFrom(from);
basic.setOriginalTo(to);
basic = userService.saveSingleJourney(basic, "token");

~~DISQUS~~

core/mobilityservice.txt · Last modified: 21/11/2017 08:26 by Raman