Fare calculation for using commuter pass
Calculate the commuter pass charge.
※Sample image (Ekispert API HTML5 Interface Sample)
attention!
You can assign the commuter pass to only railway.
Related URL
- route search /search/course/extreme
- simple route search /search/course
- route search by average wait time /search/course/plain
- route reproduction or cummuter pass / train assginment /course/edit
Procedures
1. Create commuter pass route string
Use route search by average wait time to create commuter pass route string.
It is not possible to create such string by using route search by operation diagram.
Although route search/search/course/extreme
is used at the example request, you can also use the following: simple route search、route search by average wait time
※ The request example is written in Japanese, but if Japanese is included in the request parameter, please encode URL (percent encoding) of the Japanese part with UTF 8.
GET /v1/xml/search/course/extreme?key=your_access_key_hear&viaList=高円寺:渋谷&searchType=plain
<ResultSet apiVersion="1.27.0.0" engineVersion="201704_01a">
<Course searchType="plain" dataType="plain">
<Route timeOther="9" timeOnBoard="13" exhaustCO2="202" index="1" exhaustCO2atPassengerCar="1545" distance="92" timeWalk="0" transferCount="1">
<Point index="1">
<Station code="22671">
<Name>高円寺</Name>
:
<Line direction="Up" stopStationCount="1" teiki3Index="1" teiki6Index="1" timeOnBoard="6" exhaustCO2="127" fareIndex="1" index="1" exhaustCO2atPassengerCar="974" distance="58" teiki1Index="1">
<Name>JR中央線快速</Name>
:
<Point index="2">
<Station code="22741">
<Name>新宿</Name>
:
<Line direction="Down" stopStationCount="2" teiki3Index="1" teiki6Index="1" timeOnBoard="7" exhaustCO2="74" fareIndex="1" index="2" exhaustCO2atPassengerCar="571" distance="34" teiki1Index="1">
<Name>JR山手線内回り</Name>
:
<Point index="3">
<Station code="22715">
<Name>渋谷</Name>
:
Create the commuter pass route string which is a colon-separated string such as 高円寺:JR中央線快速:Up:新宿:JR山手線内回り:Down:渋谷
by combining strings obtained by station name ResultSet/Course/Route/Point/Station/Name
, average rail ResultSet/Course/Route/Line/Name
and the direction of average rail ResultSet/Course/Route/Line/direction
.
This string will be used for the parameter of assignDetailRoute at step 2.
attention!
The specification of station name, average rail and the direction of average rail used in the commuter pass route string should be exact.
It is possible that unexpected route would be assgined if you specify undefined string in station name or average rail, or you specify them in wrong order.
correct: 高円寺:JR中央線快速:Up:新宿:JR山手線内回り:Down:渋谷
wrong: 高円寺:JR中央線快速:Up:新宿:JR山手線内回り:Down:渋谷
wrong: 高円寺:JR中央線快速:Up:新宿:JR山手線:Down:渋谷
wrong: 高円寺:JR中央線快速・東京行:Up:新宿:JR山手線内回り:Down:渋谷
2. Search route
Perform route search /search/course/extreme
using commuter pass route string obtained at step 1.
Although route search/search/course/extreme
is used at the example request, you can alse use
route reproduction or cummuter pass / train assginment.
By using bringAssignmentError prameter, error would be returned when no route is assigned
※ The request example is written in Japanese, but if Japanese is included in the request parameter, please encode URL (% encode) of the Japanese part with UTF 8.
GET /v1/xml/search/course/extreme?key=your_access_key_here&viaList=新宿:恵比寿&assignDetailRoute=高円寺:JR中央線快速:Up:新宿:JR山手線内回り:Down:渋谷&bringAssignmentError=true
<ResultSet apiVersion="1.27.0.0" engineVersion="201705_02a">
<Course searchType="departure" dataType="onTimetable">
<Route timeOther="6" timeOnBoard="45" exhaustCO2="708" index="1" exhaustCO2atPassengerCar="5409" distance="322" timeWalk="0" transferCount="1">
<Point index="1">
<Station code="22799">
<Name>立川</Name>
:
<Line stopStationCount="11" teiki3Index="1" teiki6Index="1" timeOnBoard="29" track="railway" exhaustCO2="470" fareIndex="1" index="1" exhaustCO2atPassengerCar="3595" distance="214" teiki1Index="1">
<Name>JR中央線快速・東京行</Name>
<Type>train</Type>
<ArrivalState no="4">
<Type>extension</Type>
<Datetime operation="today">2017-04-27T17:29:00+09:00</Datetime>
</ArrivalState>
<Destination>東京</Destination>
<TimeReliability>onTimetable</TimeReliability>
<DepartureState no="4">
<Type>normal</Type>
<Datetime operation="today">2017-04-27T17:00:00+09:00</Datetime>
</DepartureState>
<Color>250060002</Color>
</Line>
<Point index="2">
<Station code="22671">
<Name>高円寺</Name>
:
<Line stopStationCount="1" teiki3Index="1" teiki6Index="1" timeOnBoard="7" track="railway" exhaustCO2="127" fareIndex="2" index="2" exhaustCO2atPassengerCar="974" distance="58" teiki1Index="1">
<Name>JR中央線快速・東京行</Name>
<Type>train</Type>
<ArrivalState no="8">
<Type>normal</Type>
<Datetime operation="today">2017-04-27T17:36:00+09:00</Datetime>
</ArrivalState>
<Destination>東京</Destination>
<TimeReliability>onTimetable</TimeReliability>
<DepartureState no="4">
<Type>extension</Type>
<Datetime operation="today">2017-04-27T17:29:00+09:00</Datetime>
</DepartureState>
<Color>250060002</Color>
</Line>
<Point index="3">
<Station code="22741">
<Name>新宿</Name>
:
<Line stopStationCount="2" teiki3Index="1" teiki6Index="1" timeOnBoard="7" track="railway" exhaustCO2="74" fareIndex="2" index="3" exhaustCO2atPassengerCar="571" distance="34" teiki1Index="1">
<Name>JR山手線内回り・渋谷・品川方面</Name>
<Type>train</Type>
<ArrivalState no="2">
<Type>extension</Type>
<Datetime operation="today">2017-04-27T17:49:00+09:00</Datetime>
</ArrivalState>
<Destination>大崎</Destination>
<TimeReliability>onTimetable</TimeReliability>
<DepartureState no="14">
<Type>normal</Type>
<Datetime operation="today">2017-04-27T17:42:00+09:00</Datetime>
</DepartureState>
<Color>045232013</Color>
</Line>
<Point index="4">
<Station code="22715">
<Name>渋谷</Name>
:
<Line stopStationCount="0" teiki3Index="1" teiki6Index="1" timeOnBoard="2" track="railway" exhaustCO2="35" fareIndex="3" index="4" exhaustCO2atPassengerCar="268" distance="16" teiki1Index="1">
<Name>JR山手線内回り・渋谷・品川方面</Name>
<Type>train</Type>
<ArrivalState no="2">
<Type>normal</Type>
<Datetime operation="today">2017-04-27T17:51:00+09:00</Datetime>
</ArrivalState>
<Destination>大崎</Destination>
<TimeReliability>onTimetable</TimeReliability>
<DepartureState no="2">
<Type>extension</Type>
<Datetime operation="today">2017-04-27T17:49:00+09:00</Datetime>
</DepartureState>
<Color>045232013</Color>
</Line>
<Point index="5">
<Station code="22548">
<Name>恵比寿</Name>
:
<Price kind="FareSummary">
<Oneway>530</Oneway>
<Round>1060</Round>
:
In the example response, commuter pass charge for one-way route is 530 yen. (As of April 2017, in normal ticket.) It can be confirmed that commuter pass charge is reflected because general fee for one-way route is 550 yen. (As of April 2017, in normal ticket.)
note
Although it is possible to go to Ebisu station from Shinjuku station by JR-Yamanote-Line without transfer, the section is separated at Shibuya station in the example response.
You can determine whether the train extends or not by cheking the value of station state (ResultSet/Course/Route/Line/DepartureState/Type
or
ResultSet/Course/Route/Line/ArrivalState/Type
).
Both the values of ResultSet/Course/Route/Line/ArrivalState/Type
at the section bitween Shinjuku station and Shibuya station, and at the section bitween Shibuya station are extension
.
Which means that the train only pass the Shibuya station and it does not need to transfer.
attention!
AssignRoute parameter can also be used for calculate cummuter pass charge, but it is possible that the opposite direction of some loop lines are deducted from fee. Therfore, to keep exactness of the route, we recommend to use the assignDetailRoute parameter which can consider the direction of line.