Charlottetown Transit API

From rukapedia
Revision as of 18:13, 2 September 2008 by Peter (talk | contribs)
Jump to: navigation, search

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.

Routes

Returns information on Charlottetown Transit routes.

URL /api/routes
Method GET
Querystring None
Returns XML

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>

Stops

Returns information on the stops in a given Charlottetown Transit route.

URL /api/route/[routenumber]/stops
Method GET
Querystring None
Returns XML

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>

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

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>

Schedule

Returns information on the scheuled service at single stop in a given Charlottetown Transit route.

URL /api/route/[routenumber]/stop/[stopnumber]/schedule
Method GET
Querystring None
Returns XML

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>