Those people who live, or have lived in Perth are likely familiar with the government organisation that provides the public transportation facilities, Transperth.
Put simply, I wished to create a more or less simply to use API library in Python to pull data out of their system. I originally thought that this would primarily involve scraping their website, as I had trouble figuring out the location of the API the mobile app used.
I think I have now figured it out, in part;
Example; http://livetimes.transperth.wa.gov.au/LiveTimes.asmx/GetSercoTimesForStation?stationname=Perth%20Underground%20Stn Python interface; https://github.com/Mause/pytransperth/blob/master/transperth/livetimes.py
I found a JSON string in
that gave a list of the lines and station names that the API would accept. The example above shows the corresponding URL for the 1
com.jeppesen.transperth.vm.TrainTimesVm
.1
Perth Underground Stn
Root URL; https://api.transperth.info/DesktopModules/JJPApiService/api/jjpapi
The SaaS service provides endpoints for reference data (stops, routes, timetable, etc.), a journey planner, a localities index, a nearby stops service, a timetable lookup, and a trip lookup, presumably for trips already determined via the API.
Having rooted my phone, and installing Root Browser to access the android Transperth App’s assets, I was able to retrieve the
for the Silver Rails API, as well as many other settings.1
ApiKey
Because I would probably get the shit sued out of me, I don’t feel comfortable sharing the key here.
Anyway, using the ApiKey, I was able to download all the reference data that the app uses which is a rather large amount, and it seems to be downloaded everytime the app is started, at least partially. I shall investigate this further.
The reference data contains info about;
1
Curtin University of Technology
for exampleUsing
, I managed to extract an XML file from the 1
apktool
that contains a large number of strings not present in the code I extracted. This is where I retrieved the list of datasets for the Silver Rail Technology API from;1
.apk
You can insert these into some of the above URLs, along with a an
query parameter, to make use of the endpoint.1
ApiKey
I also found some documentation; http://journeyplanner.silverrailtech.com/JourneyPlanner/Help/html/R_Project_Journey_Planner_Interface_Specification.htm
Browsing through the action list on the transperth website, I noticed that it generated a synthetic TAG ON event to account for my incorrect TAG ON at the wrong scanner.