Charlottetown Transit API
From rukapedia
This document describes a RESTful API that provides access to the same stop, route and schedule information that is used to power the Charlottetown Interactive Transit Map.
Contents |
[edit]
Routes
Returns information on Charlottetown Transit routes.
| URL | /api/routes |
| Method | GET |
| Querystring | None |
| Returns | XML |
[edit]
Example
# curl http://thebus.ca/api/routes
<?xml version="1.0"?>
<routes>
<route>
<number>1</number>
<name>University Ave. Express</name>
<markercolour>yellow</markercolour>
<routecolour>ff0000</routecolour>
<lightcolour>ff847f</lightcolour>
<note/>
</route>
</routes>
[edit]
Stops
Returns information on the stops in a given Charlottetown Transit route.
| URL | /api/route/[routenumber]/stops |
| Method | GET |
| Querystring | None |
| Returns | XML |
[edit]
Example
# curl http://thebus.ca/api/route/1/stops
<?xml version="1.0"?>
<stops>
<stop>
<number>1</number>
<name>Confederation Centre</name>
<latitude>46.234307</latitude>
<longitude>-63.128021</longitude>
</stop>
...
<stop>
<number>12</number>
<name>Richmond and Queen</name>
<latitude>46.233454</latitude>
<longitude>-63.127044</longitude>
</stop>
</stops>
[edit]
Single Stop
Returns information on a single stop in a given Charlottetown Transit route.
| URL | /api/route/[routenumber]/stop/[stopnumber] |
| Method | GET |
| Querystring | None |
| Returns | XML |
[edit]
Example
# curl http://thebus.ca/api/route/1/stop/12
<?xml version="1.0"?>
<stops>
<stop>
<number>12</number>
<name>Richmond and Queen</name>
<latitude>46.233454</latitude>
<longitude>-63.127044</longitude>
</stop>
</stops>
[edit]
Schedule
Returns information on the scheduled service at single stop in a given Charlottetown Transit route.
| URL | /api/route/[routenumber]/stop/[stopnumber]/schedule |
| Method | GET |
| Querystring | after HH:MM (only show service after the given time; use 24hr clock) direction O or I (only show Outbound or Inbound service) limit integer (limit results to given number) |
| Returns | XML |
[edit]
Example
# http://thebus.ca/api/route/1/stop/1/schedule?after=17:00&limit=1&direction=O
<?xml version="1.0"?>
<schedule>
<service>
<time>17:10:00</time>
<direction>O</direction>
</service>
</schedule>
# http://thebus.ca/api/route/1/stop/1/schedule?limit=2&direction=O
<?xml version="1.0"?>
<schedule>
<service>
<time>06:45:00</time>
<direction>O</direction>
</service>
<service>
<time>07:04:00</time>
<direction>O</direction>
</service>
</schedule>

