approved, byrokraatit, ylläpitäjät
0
muokkausta
Ei muokkausyhteenvetoa |
|||
Rivi 109: | Rivi 109: | ||
Rest access responds to HTTP GET requests and returns JSON formatted textual data. The data itself is structured and named like standard SIRI XML responses (it is just converted from SIRI XML to JSON notation). This allows the client avoid XML request parsing which is typically cumbersome for example to JavaScript clients. | Rest access responds to HTTP GET requests and returns JSON formatted textual data. The data itself is structured and named like standard SIRI XML responses (it is just converted from SIRI XML to JSON notation). This allows the client avoid XML request parsing which is typically cumbersome for example to JavaScript clients. | ||
==== Requests ==== | |||
To access the SIRI vehicle monitoring client must send HTTP GET requests to http://178.217.134.37:8080/siriaccess/vm/rest | To access the SIRI vehicle monitoring client must send HTTP GET requests to http://178.217.134.37:8080/siriaccess/vm/rest | ||
Rivi 116: | Rivi 117: | ||
* indent=<yes|no> | * indent=<yes|no> | ||
==== Url examples ==== | ===== Url examples ===== | ||
* http://178.217.134.37:8080/siriaccess/vm/rest returns data for all vehicles | * http://178.217.134.37:8080/siriaccess/vm/rest returns data for all vehicles | ||
* http://178.217.134.37:8080/siriaccess/vm/rest?lineRef=22 returns data for all vehicles currently operating on specified line | * http://178.217.134.37:8080/siriaccess/vm/rest?lineRef=22 returns data for all vehicles currently operating on specified line | ||
* http://178.217.134.37:8080/siriaccess/vm/rest?vehicleRef=paunu_155 returns data for specified vehicle | * http://178.217.134.37:8080/siriaccess/vm/rest?vehicleRef=paunu_155 returns data for specified vehicle | ||
* http://178.217.134.37:8080/siriaccess/vm/rest?indent=yes returns data in human readable format, indent parameter works also in conjunction with lineRef and vehicleRef parameters, for example http://178.217.134.37:8080/siriaccess/vm/rest?indent=yes&lineRef=22 | * http://178.217.134.37:8080/siriaccess/vm/rest?indent=yes returns data in human readable format, indent parameter works also in conjunction with lineRef and vehicleRef parameters, for example http://178.217.134.37:8080/siriaccess/vm/rest?indent=yes&lineRef=22 | ||
==== Responses ==== | |||
<pre> | |||
{ | |||
"Siri" : { | |||
"ServiceDelivery" : { | |||
"ResponseTimestamp" : 1379169513744, | |||
"ProducerRef" : { | |||
"value" : "IJ2010" | |||
}, | |||
"Status" : true, | |||
"MoreData" : false, | |||
"VehicleMonitoringDelivery" : [ { | |||
"VehicleActivity" : [ { | |||
"ValidUntilTime" : 1379169543010, | |||
"MonitoredVehicleJourney" : { | |||
"LineRef" : { | |||
"value" : "5" | |||
}, | |||
"DirectionRef" : { | |||
"value" : "2" | |||
}, | |||
"FramedVehicleJourneyRef" : { | |||
"DataFrameRef" : { | |||
"value" : "2013-09-14" | |||
}, | |||
"DatedVehicleJourneyRef" : "1705" | |||
}, | |||
"OperatorRef" : { | |||
"value" : "TKL" | |||
}, | |||
"OriginName" : { | |||
"value" : "Keskustori I", | |||
"lang" : "fi" | |||
}, | |||
"DestinationName" : { | |||
"value" : "Hervantakeskus", | |||
"lang" : "fi" | |||
}, | |||
"Monitored" : true, | |||
"VehicleLocation" : { | |||
"Longitude" : 23.8516535, | |||
"Latitude" : 61.4486107 | |||
}, | |||
"Bearing" : 0.0, | |||
"Delay" : "P0Y0M0DT0H3M28.000S", | |||
"VehicleRef" : { | |||
"value" : "TKL_94" | |||
} | |||
}, | |||
"RecordedAtTime" : 1379169513010 | |||
} ], | |||
"version" : "1.3", | |||
"ResponseTimestamp" : 1379169513744, | |||
"Status" : true | |||
} ] | |||
}, | |||
"version" : "1.3" | |||
} | |||
} | |||
</pre> |