Overview

All of CDTA’s Route and Schedule API are read-only in nature, use HTTP/1.1 as the application protocol for communication, with HTTP GET as the method to call the service, and JSON formatted data as the default response. An XML response is also available if specified.

Each API begins with a base URL followed by parameters and arguments. The service arguments are separated by either a forward slash ("/") as part of the URL path, or GET parameters with the standard "?/&/=" separators.

The version of the API will be built into the URL, for example http://api.cdta.org/api/v1/?request=routes.

An API key will be required to make requests to the API. All requests to the API must be accompanied by a valid API key. The API is still in BETA so please email us here to receive a key for testing purposes: API Key Request.

Updates

These are new items that have been added or changed within the CDTA API as we move along during development.

# Area Description
0051 Search New endpoint that searches stop names, landmark names, stop ids and routes for relevant information. Will return urls to relevant information within API and on CDTA website.
0043 Search Stops New endpoint that searches stop names and stop ids for relevant stops. Also searches landmarks.
0041 Near Stops Added nearest landmarks as separate list (array).
0041 All Included Links to Browser Based Examples for all endpoints. (XML examples will need to view source to see return value)
0038 Stops Enabled endpoint to return all stops when no route_id is specified, all CDTA stops will be returned in alphabetical order

Issues

These are the current issues or bugs with the CDTA API as we move along during development.

# Area Description
0033 Near Stops Distance: The current distance is in degrees and is an approximation using the Pythagorean distance formula.
0034 Near Stops Distance Feet: The calculation for the distance in feet is based on the length of degree at a specific latitude. This is currently set the average of 268977.45 for one degree of longitude and 364455.15 for one degree of latitude. Suffice to say the distance in feet is an APPROXIMIATION. For miles the lengths are 59.98 for one degree of latitude and 50.94 for one degree of longitude.

Authentication

All requests to the CDTA API require an application key to validate the request. The application key is requested by the developer from CDTA and will be used to track the number and type of requests that are made.

Response Codes

A HTTP Get Request will return one of the following response codes.

  • Status
  • 200
    Ok - the request was good and response is valid.
    401
    Unauthorized - invalid API key
    404
    Not Found
    405
    Invalid Method - we only do GETs around here
    415
    Unsupported Media Type - we only do JSON and XML
    429
    Too Many Request – your application has exceeded the number of requests possible. Contact developer support to increase your request threshold.
    500
    Server Error – sorry something went wrong, please try again later
    503
    Service Unavailable – again really sorry, service is temporarily down, please try again later

Time

This method may be used to determine if your application time is synchronized to systems time. This may be used to determine if “next scheduled bus”.

GET /api/v1/?request=time

Returns the current system date and time.

  • Parameters
  • key
    (required) string API Access Key.
    format
    (optional) string json (default); xml.
  • Response Fields
  • time
    (required) date-time current system time in format YYYYMMDD HH:MI:SS
    uri
    (required) string self referencing uri
  • Response-JSON 200 SHOW
  • < Content-Type: application/json >
    {
    	"time":"20131010 10:57:05",
    	"uri":"\/api\/v1\/time"
    }
    
  • Response-XML 200 SHOW
  • < Content-Type: application/xml >
    <?xml version="1.0"?>
    <cdta-response>
    	<time>20131010 12:07:47</time>
    	<uri>/api/v1/time</uri>
    </cdta-response>
    
  • Examples
  • Hint: Click on the Example Name to see response in browser.
    default
    curl -G "http://api.cdta.org/api/v1/?request=time" -H "key:<apikey>"
    format specified
    curl -G "http://api.cdta.org/api/v1/?request=time&format=xml" -H "key:<apikey>"

Routes

This method is used to get either a full list of route information or an individual route

GET /api/v1/?request=routes/{route_id}

Returns the detailed information for a route including name, type, description, urls to pdf schedule, kml and map images. There are also styling information for the route including color and text color. If no {route_id} is specified then a list of all routes will be returned.

  • Parameters
  • route_id
    (optional) string The route identifier. If no identifier specified then all routes are returned.
    key
    (required) string API Access Key.
    format
    (optional) string json (default); xml.
  • Response Fields
  • route_id
    (required) string one, two or three digit route identifier
    route_name
    (required) string name of route
    route_type
    (required) string route type (BRT, Trunk, Neighborhood, Commuter, Express, Northway Express)
    route_description
    (required) string route running description
    route_url
    (required) string full cdta website url for the route
    schedule_url
    (required) string full url for the route pdf schedule (.pdf)
    map_kml_url
    (required) string full url for the route kml file (.kml)
    map_image_url
    (required) string full url for the route map image (.png)
    route_color
    (required) string Hex value representing the route badge (background circle) or line color
    route_text_color
    (required) string Hex value representing the route text color on top of the route badge or line
    service_days
    (required) string Comma separated list of which days the service is run, these include: Weekday, specific day of week (ex. Wednesday), Saturday and/or Sunday
    route_effective_date
    (required) string effective date of the route information YYYYMMDD HH:MI:SS
    route_schedule_uri
    (required) string route schedule reference uri
    uri
    (required) string self reference uri
  • Response-JSON 200 SHOW
  • < Content-Type: application/json >
    {
    	"routes" : [{
    			"route_id" : "1",
    			"route_name" : "Central Avenue",
    			"route_type" : "Trunk",
    			"route_description" : "<p><strong><u>East<\/u><\/strong><\/p>\r\n\r\n<p>Leave the bus shelter in front of Colonie Center via north on Wolf Road, to a right into Colonie Center at Dunkin Donuts. Bear left around the back of Macy&rsquo;s, to left at the stop sign, to left on Sand Creek Road, to left on Wolf Road, to left on Central Avenue, into Washington Avenue, to right on Eagle Street, to left on State Street, to right on Broadway, to right on Madison Avenue, to Madison Avenue staging area.<\/p>\r\n\r\n<p><u><strong>West<\/strong><\/u><\/p>\r\n\r\n<p>Leave Staging Area via right on Green Street, to a left on Dallius Street, to a right on Division Street, to a left on Broadway, to left on State Street, to right on Eagle Street, to left on Washington Avenue, bear right to Central Avenue, to right on Wolf Road, to the bus cutout in front of Colonie Center.<\/p>",
    			"route_url" : "http:\/\/api.cdta.org\/schedules_route_details.php?route_id=7",
    			"schedule_url" : "http:\/\/api.cdta.org\/uploads\/Route1.pdf",
    			"map_kml_url" : "http:\/\/api.cdta.org\/kml\/Route1.kml",
    			"map_image_url" : "http:\/\/api.cdta.org\/images\/Route1.png",
    			"route_color" : "123573",
    			"route_text_color" : "FFFFFF",
    			"service_days" : "Weekday,Saturday,Sunday",
    			"route_effective_date" : "20110828 00:00:00",
    			"route_direction_uri" : "\/api\/v1\/routedirections\/1",
    			"route_schedule_uri" : "\/api\/v1\/schedules\/1",
    			"uri" : "\/api\/v1\/route\/1"
    		}, {
    			"route_id" : "6",
    			"route_name" : "Second\/Whitehall",
    			"route_type" : "Trunk",
    			"route_description" : "<p><u><strong>Southbound<\/strong><\/u><\/p>\r\n\r\n<p>Operate via right on Broadway, to a left on Clinton Avenue, to a left on Pearl Street, to a right on Second Avenue, to Whitehall Road, to a right on Manning Boulevard, to the bus cut-out in front of St. Peters Hospital.<\/p>\r\n\r\n<p><u><strong>Northbound<\/strong><\/u><\/p>\r\n\r\n<p>Operate via Manning Boulevard, to a left on New Scotland Avenue, to a left on Whitehall Road, to Second Avenue, to a left on Pearl Street, to Capital Repertory Theater.<\/p>",
    			"route_url" : "http:\/\/api.cdta.org\/schedules_route_details.php?route_id=120",
    			"schedule_url" : "http:\/\/api.cdta.org\/uploads\/x.php;x.jpg",
    			"map_kml_url" : "http:\/\/api.cdta.org\/kml\/Route6.kml",
    			"map_image_url" : "http:\/\/api.cdta.org\/images\/Route6.png",
    			"route_color" : "123573",
    			"route_text_color" : "FFFFFF",
    			"service_days" : "Weekday,Saturday,Sunday",
    			"route_effective_date" : "20130825 00:00:00",
    			"route_direction_uri" : "\/api\/v1\/routedirections\/6",
    			"route_schedule_uri" : "\/api\/v1\/schedules\/6",
    			"uri" : "\/api\/v1\/route\/6"
    		}, {
    		...
    		}, {
    			"route_id" : "905",
    			"route_name" : "Albany \/ Schenectady",
    			"route_type" : "BRT",
    			"route_description" : "<p><strong><u>Eastbound<\/u><\/strong><\/p>\r\n\r\n<p>Leave Liberty Park, Continue East on State St To Central Ave, Right on Broadway, Right on Hudson Ave, Left on Dallius St, Right on Madison Ave<\/p>\r\n\r\n<p><strong><u>Westbound<\/u><\/strong><\/p>\r\n\r\n<p>Leave Madison Ave, Right on Green St, Left on Dallius St, Right on Division St ,Left on Broadway, Left on State St, Right on Eagle St, Left on Washington Ave, Bear Right onto Central Ave to State St, Left on Erie BLVD, Right on South Church St, Left on Fuller St around the Armory to Washington Ave to Liberty Park.<\/p>",
    			"route_url" : "http:\/\/api.cdta.org\/schedules_route_details.php?route_id=109",
    			"schedule_url" : "http:\/\/api.cdta.org\/uploads\/fr.it.php",
    			"map_kml_url" : "http:\/\/api.cdta.org\/kml\/Route905.kml",
    			"map_image_url" : "http:\/\/api.cdta.org\/images\/Route905.png",
    			"route_color" : "d72c2a",
    			"route_text_color" : "FFFFFF",
    			"service_days" : "Weekday,Saturday,Sunday",
    			"route_effective_date" : "20130825 00:00:00",
    			"route_direction_uri" : "\/api\/v1\/routedirections\/905",
    			"route_schedule_uri" : "\/api\/v1\/schedules\/905",
    			"uri" : "\/api\/v1\/route\/905"
    		}
    	],
    	"uri" : "\/api\/v1\/route"
    }
    
  • Response-XML 200 SHOW
  • < Content-Type: application/xml >
    <?xml version="1.0"?>
    <cdta-response>
    	<routes>
    		<item0>
    			<route_id>1</route_id>
    			<route_name>Central Avenue</route_name>
    			<route_type>Trunk</route_type>
    			<route_description><p><strong><u>East</u></strong></p>

<p>Leave the bus shelter in front of Colonie Center via north on Wolf Road, to a right into Colonie Center at Dunkin Donuts. Bear left around the back of Macy&rsquo;s, to left at the stop sign, to left on Sand Creek Road, to left on Wolf Road, to left on Central Avenue, into Washington Avenue, to right on Eagle Street, to left on State Street, to right on Broadway, to right on Madison Avenue, to Madison Avenue staging area.</p>

<p><u><strong>West</strong></u></p>

<p>Leave Staging Area via right on Green Street, to a left on Dallius Street, to a right on Division Street, to a left on Broadway, to left on State Street, to right on Eagle Street, to left on Washington Avenue, bear right to Central Avenue, to right on Wolf Road, to the bus cutout in front of Colonie Center.</p></route_description>
    			<route_url>http://api.cdta.org/schedules_route_details.php?route_id=7</route_url>
    			<schedule_url>http://api.cdta.org/uploads/Route1.pdf</schedule_url>
    			<map_kml_url>http://api.cdta.org/kml/Route1.kml</map_kml_url>
    			<map_image_url>http://api.cdta.org/images/Route1.png</map_image_url>
    			<route_color>123573</route_color>
    			<route_text_color>FFFFFF</route_text_color>
    			<service_days>Weekday,Saturday,Sunday</service_days>
    			<route_effective_date>20110828 00:00:00</route_effective_date>
    			<route_direction_uri>/api/v1/routedirections/1</route_direction_uri>
    			<route_schedule_uri>/api/v1/schedules/1</route_schedule_uri>
    			<uri>/api/v1/route/1</uri>
    		</item0>
    		<item1>
    			<route_id>6</route_id>
    			<route_name>Second/Whitehall</route_name>
    			<route_type>Trunk</route_type>
    			<route_description><p><u><strong>Southbound</strong></u></p>

<p>Operate via right on Broadway, to a left on Clinton Avenue, to a left on Pearl Street, to a right on Second Avenue, to Whitehall Road, to a right on Manning Boulevard, to the bus cut-out in front of St. Peters Hospital.</p>

<p><u><strong>Northbound</strong></u></p>

<p>Operate via Manning Boulevard, to a left on New Scotland Avenue, to a left on Whitehall Road, to Second Avenue, to a left on Pearl Street, to Capital Repertory Theater.</p></route_description>
    			<route_url>http://api.cdta.org/schedules_route_details.php?route_id=120</route_url>
    			<schedule_url>http://api.cdta.org/uploads/x.php;x.jpg</schedule_url>
    			<map_kml_url>http://api.cdta.org/kml/Route6.kml</map_kml_url>
    			<map_image_url>http://api.cdta.org/images/Route6.png</map_image_url>
    			<route_color>123573</route_color>
    			<route_text_color>FFFFFF</route_text_color>
    			<service_days>Weekday,Saturday,Sunday</service_days>
    			<route_effective_date>20130825 00:00:00</route_effective_date>
    			<route_direction_uri>/api/v1/routedirections/6</route_direction_uri>
    			<route_schedule_uri>/api/v1/schedules/6</route_schedule_uri>
    			<uri>/api/v1/route/6</uri>
    		</item1>
    		...
    		<item48>
    			<route_id>905</route_id>
    			<route_name>Albany / Schenectady</route_name>
    			<route_type>BRT</route_type>
    			<route_description><p><strong><u>Eastbound</u></strong></p>

<p>Leave Liberty Park, Continue East on State St To Central Ave, Right on Broadway, Right on Hudson Ave, Left on Dallius St, Right on Madison Ave</p>

<p><strong><u>Westbound</u></strong></p>

<p>Leave Madison Ave, Right on Green St, Left on Dallius St, Right on Division St ,Left on Broadway, Left on State St, Right on Eagle St, Left on Washington Ave, Bear Right onto Central Ave to State St, Left on Erie BLVD, Right on South Church St, Left on Fuller St around the Armory to Washington Ave to Liberty Park.</p></route_description>
    			<route_url>http://api.cdta.org/schedules_route_details.php?route_id=109</route_url>
    			<schedule_url>http://api.cdta.org/uploads/fr.it.php</schedule_url>
    			<map_kml_url>http://api.cdta.org/kml/Route905.kml</map_kml_url>
    			<map_image_url>http://api.cdta.org/images/Route905.png</map_image_url>
    			<route_color>d72c2a</route_color>
    			<route_text_color>FFFFFF</route_text_color>
    			<service_days>Weekday,Saturday,Sunday</service_days>
    			<route_effective_date>20130825 00:00:00</route_effective_date>
    			<route_direction_uri>/api/v1/routedirections/905</route_direction_uri>
    			<route_schedule_uri>/api/v1/schedules/905</route_schedule_uri>
    			<uri>/api/v1/route/905</uri>
    		</item48>
    	</routes>
    	<uri>/api/v1/route</uri>
    </cdta-response>
    
  • Response 404 SHOW
  • < Content-Type: application/json >
    {
    	"status":404,
    	"message":"Not Found"
    }
    
  • Examples
  • Hint: Click on the Example Name to see response in browser.
    all routes
    curl -G "http://api.cdta.org/api/v1/?request=routes" -H "key:<apikey>"
    route specified
    curl -G "http://api.cdta.org/api/v1/?request=routes/1" -H "key:<apikey>"
    format specified
    curl -G "http://api.cdta.org/api/v1/?request=routes/1&format=xml" -H "key:<apikey>"
    not found
    curl -G "http://api.cdta.org/api/v1/?request=routes/1000" -H "key:<apikey>"

Directions

This method may be used to get all the directions a route travels which may be used to in subsequent calls of the api to filter results.

GET /api/v1/?request=directions/{route_id}

Returns the directions for the specified route. There will be at least two directions for each route

  • Parameters
  • route_id
    (required) string The route identifier.
    key
    (required) string API Access Key.
    format
    (optional) string json (default); xml.
  • Response Fields
  • direction
    (required) string direction for the route, this is what is show on the heads sign on buses
    route_schedule_uri
    (required) string reference uri for route schedule for direction
    uri
    (required) string self reference uri
  • Response-JSON 200 SHOW
  • < Content-Type: application/json >
    {
    	"directions":[{
    		"id":"0",
    		"direction":"(East) Colonie Center to Downtown Albany",
    		"route_schedule_uri":"\/api\/v1\/route_schedule\/7\/(East) Colonie Center to Downtown Albany"
    	},{
    		"id":"1",
    		"direction":"(West) Downtown Albany to Colonie Center",
    		"route_schedule_uri":"\/api\/v1\/route_schedule\/7\/(West) Downtown Albany to Colonie Center"
    	}],
    	"uri":"\/api\/v1\/directions\/1"
    }
    
  • Response-XML 200 SHOW
  • < Content-Type: application/xml >
    <?xml version="1.0"?>
    <cdta-response>
    	<directions>
    		<item0>
    			<id>0</id>
    			<direction>(East) Colonie Center to Downtown Albany</direction>
    			<route_schedule_uri>/api/v1/route_schedule/7/(East) Colonie Center to Downtown Albany</route_schedule_uri>
    		</item0>
    		<item1>
    			<id>1</id>
    			<direction>(West) Downtown Albany to Colonie Center</direction>
    			<route_schedule_uri>/api/v1/route_schedule/7/(West) Downtown Albany to Colonie Center</route_schedule_uri>
    		</item1>
    	</directions>
    	<uri>/api/v1/directions/1</uri>
    </cdta-response>
    
  • Response 404 SHOW
  • < Content-Type: application/json >
    {
    	"status":404,
    	"message":"Not Found"
    }
    
  • Examples
  • Hint: Click on the Example Name to see response in browser.
    default
    curl -G "http://api.cdta.org/api/v1/?request=directions/1" -H "key:<apikey>"
    format specified
    curl -G "http://api.cdta.org/api/v1/?request=directions/1&format=xml" -H "key:<apikey>"
    not found
    curl -G "http://api.cdta.org/api/v1/?request=directions/1000" -H "key:<apikey>"

Route

This method returns detailed information for a specified route

GET /api/v1/?request=route/{route_id}

Returns the detailed information for a route including name, type, description, urls to pdf schedule, kml and map images. There are also styling information for the route including color and text color.

  • Parameters
  • route_id
    (required) string The route identifier.
    key
    (required) string API Access Key.
    format
    (optional) string json (default); xml.
  • Response Fields
  • route_id
    (required) string one, two or three digit route identifier
    route_name
    (required) string name of route
    route_type
    (required) string route type (BRT, Trunk, Neighborhood, Commuter, Express, Northway Express)
    route_description
    (required) string route running description
    route_url
    (required) string full cdta website url for the route
    schedule_url
    (required) string full url for the route pdf schedule (.pdf)
    map_kml_url
    (required) string full url for the route kml file (.kml)
    map_image_url
    (required) string full url for the route map image (.png)
    route_color
    (required) string Hex value representing the route badge (background circle) or line color
    route_text_color
    (required) string Hex value representing the route text color on top of the route badge or line
    service_days
    (required) string Comma separated list of which days the service is run, these include: Weekday, specific day of week (ex. Wednesday), Saturday and/or Sunday
    route_effective_date
    (required) string effective date of the route information YYYYMMDD HH:MI:SS
    route_schedule_uri
    (required) string route schedule reference uri
    uri
    (required) string self reference uri
  • Response-JSON 200 SHOW
  • < Content-Type: application/json >
    [{
    	"route_id":"1",
    	"route_name":"Central Avenue",
    	"route_type":"Trunk",
    	"route_description":"<p><strong><u>East<\/u><\/strong><\/p>\r\n\r\n<p>Leave the bus shelter in front of Colonie Center via north on Wolf Road, to a right into Colonie Center at Dunkin Donuts. Bear left around the back of Macy&rsquo;s, to left at the stop sign, to left on Sand Creek Road, to left on Wolf Road, to left on Central Avenue, into Washington Avenue, to right on Eagle Street, to left on State Street, to right on Broadway, to right on Madison Avenue, to Madison Avenue staging area.<\/p>\r\n\r\n<p><u><strong>West<\/strong><\/u><\/p>\r\n\r\n<p>Leave Staging Area via right on Green Street, to a left on Dallius Street, to a right on Division Street, to a left on Broadway, to left on State Street, to right on Eagle Street, to left on Washington Avenue, bear right to Central Avenue, to right on Wolf Road, to the bus cutout in front of Colonie Center.<\/p>",
    	"route_url":"http:\/\/api.cdta.org\/schedules_route_details.php?route_id=7",
    	"schedule_url":"http:\/\/api.cdta.org\/uploads\/Route1.pdf",
    	"map_kml_url":"http:\/\/api.cdta.org\/kml\/Route1.kml",
    	"map_image_url":"http:\/\/api.cdta.org\/images\/Route1.png",
    	"route_color":"123573",
    	"route_text_color":"FFFFFF",
    	"service_days":"Weekday,Saturday,Sunday",
    	"route_effective_date":"20110828 00:00:00",
    	"route_schedule_uri":"\/api\/v1\/routechedules\/1",
    	"uri":"\/api\/v1\/route\/1"
    }]
    
  • Response-XML 200 SHOW
  • < Content-Type: application/xml >
    <?xml version="1.0"?>
    <cdta-response>
    	<item0>
    		<route_id>1</route_id>
    		<route_name>Central Avenue</route_name>
    		<route_type>Trunk</route_type>
    		<route_description><p><strong><u>East</u></strong></p><p>Leave the bus shelter in front of Colonie Center via north on Wolf Road, to a right into Colonie Center at Dunkin Donuts. Bear left around the back of Macy&rsquo;s, to left at the stop sign, to left on Sand Creek Road, to left on Wolf Road, to left on Central Avenue, into Washington Avenue, to right on Eagle Street, to left on State Street, to right on Broadway, to right on Madison Avenue, to Madison Avenue staging area.</p><p><u><strong>West</strong></u></p>#xD;<p>Leave Staging Area via right on Green Street, to a left on Dallius Street, to a right on Division Street, to a left on Broadway, to left on State Street, to right on Eagle Street, to left on Washington Avenue, bear right to Central Avenue, to right on Wolf Road, to the bus cutout in front of Colonie Center.</p></route_description>
    		<route_url>http://api.cdta.org/schedules_route_details.php?route_id=7</route_url>
    		<schedule_url>http://api.cdta.org/uploads/Route1.pdf</schedule_url>
    		<map_kml_url>http://api.cdta.org/kml/Route1.kml</map_kml_url>
    		<map_image_url>http://api.cdta.org/images/Route1.png</map_image_url>
    		<route_color>123573</route_color>
    		<route_text_color>FFFFFF</route_text_color>
    		<service_days>Weekday,Saturday,Sunday</service_days>
    		<route_effective_date>20110828 00:00:00</route_effective_date>
    		<route_schedule_uri>/api/v1/routechedules/1</route_schedule_uri>
    		<uri>/api/v1/route/1</uri>
    	</item0>
    </cdta-response>
    
  • Response 404 SHOW
  • < Content-Type: application/json >
    {
    	"status":404,
    	"message":"Not Found"
    }
    
  • Examples
  • Hint: Click on the Example Name to see response in browser.
    default
    curl -G "http://api.cdta.org/api/v1/?request=route/1" -H "key:<apikey>"
    format specified
    curl -G "http://api.cdta.org/api/v1/?request=route/1&format=xml" -H "key:<apikey>"
    not found
    curl -G "http://api.cdta.org/api/v1/?request=route/1000" -H "key:<apikey>"

Schedules

This method returns trip schedules for the specified route and direction. A trip contains a list of stops in order of scheduled arrival time.

GET /api/v1/?request=schedules/{route_id}/{service_type}/{direction_id}

Returns full set of trips with related schedules for a route, service type and direction if specified

  • Issues
  • Stop Times
    Not all trips have arrivals times at all stops listed in stop[] array. There are many variants for certain routes. It is up to the developer to use the stops[] array as a guide and check the stop_times[] array to ensure there is a match.
    Direction Name
    This end point currently accepts direction_id as a parameter and does not accept direction_name.
  • Parameters
  • route_id
    (required) string Route Identifier.
    service_type
    (required) string Service type for route (Weekday, Saturday, Sunday)
    direction_id
    (required) string Direction Identifier. // almost always 0 or 1
    key
    (required) string API Access Key.
    format
    (optional) string json (default); xml.
    • Response Fields
    • direction[]
      (required) array Specific direction for a route contains an array of stops and stop_times
      direction_name
      (required) string long direction name
      direction
      (required) integer direction id
      stops[]
      (required) array array of stops in order of arrival
      stop_id
      (required) string public identifier of the stop
      stop_name
      (required) string name of the stop
      stop_arrivals_uri
      (required) integer uri of the arrivals for this specific stop
      trips[]
      (required) array array of trips for route, schedule_type and direction
      id
      (required) string trip id - internal identifier //this can be associated with GTFS data also
      service_type
      (required) string Weekday, Saturday or Sunday //should match what was passed in to api
      stop_times[]
      (required) array array of times in order of stops, there is no guarantee that each trip contains all stops listed in the stop array
      stop_id
      (required) string public identifier of the stop
      stop_seq
      (required) int sequence of stops in this trip
      time
      (required) time scheduled arrival time at this stop
  • Response-JSON 200 SHOW
  • < Content-Type: application/json >
    {
    	"direction": {
    		"direction_name": "(East) Colonie Center to Downtown Albany",
    		"direction": "0",
    		"stops": [{
    			"stop_id": "00031",
    			"stop_name": "WOLF RD & COLONIE CENTER",
    			"stop_arrivals_uri": "\/api\/v1\/arrivals\/00031"
    		},
    		{
    			"stop_id": "10514",
    			"stop_name": "CENTRAL AVE & NORTHWAY MALL - COLONIE STATION",
    			"stop_arrivals_uri": "\/api\/v1\/arrivals\/10514"
    		},
    		{
    			"stop_id": "00207",
    			"stop_name": "CENTRAL AVE & N ALLEN ST - N. ALLEN STATION",
    			"stop_arrivals_uri": "\/api\/v1\/arrivals\/00207"
    		},
    		...
    		{
    			"stop_id": "10502",
    			"stop_name": "MADISON AVE & GREEN ST",
    			"stop_arrivals_uri": "\/api\/v1\/arrivals\/10502"
    		}],
    		"trips": {
    			"2972551": {
    				"id": "2972551",
    				"service_type": "weekday",
    				"stop_times": [{
    					"stop_id": "00031",
    					"stop_seq": 1,
    					"time": "05:00:00"
    				},
    				{
    					"stop_id": "10514",
    					"stop_seq": 2,
    					"time": "05:10:00"
    				},
    				{
    					"stop_id": "00207",
    					"stop_seq": 3,
    					"time": "05:22:00"
    				},
    				...				
    				{
    					"stop_id": "10502",
    					"stop_seq": 6,
    					"time": "05:42:00"
    				}]
    			},	
    			...
    			"2972617": {
    				"id": "2972617",
    				"service_type": "weekday",
    				"stop_times": [{
    					"stop_id": "00031",
    					"stop_seq": 1,
    					"time": "00:45:00"
    				},
    				...
    				{
    					"stop_id": "10502",
    					"stop_seq": 6,
    					"time": "01:25:00"
    				}]
    			}
    		},
    		"uri": "\/api\/v1\/schedules\/1\/weekday\/0"
    	}
    }			
    
  • Response-XML 200 SHOW
  • < Content-Type: application/xml >
    <?xml version="1.0"?>
    <cdta-response>
    	<direction>
    		<direction_name>(East) Colonie Center to Downtown Albany</direction_name>
    		<direction>0</direction>
    		<stops>
    			<item0>
    				<stop_id>00031</stop_id>
    				<stop_name>WOLF RD & COLONIE CENTER</stop_name>
    				<stop_arrivals_uri>/api/v1/arrivals/00031</stop_arrivals_uri>
    			</item0>
    			...
    			;item5>
    				<stop_id>10502</stop_id>
    				<stop_name>MADISON AVE & GREEN ST</stop_name>
    				<stop_arrivals_uri>/api/v1/arrivals/10502</stop_arrivals_uri>
    			</item5>
    		</stops>
    		<trips>
    			<item2972551>
    				<id>2972551</id>
    				<service_type>weekday</service_type>
    				<stop_times>
    					<item0>
    						<stop_id>00031</stop_id>
    						<stop_seq>1</stop_seq>
    						<time>05:00:00</time>
    					</item0>		
    					...
    					<item5>
    						<stop_id>10502</stop_id>
    						<stop_seq>6</stop_seq>
    						<time>05:42:00</time>
    					</item5>
    				</stop_times>
    			</item2972551>	
    			...
    		</trips>
    		<uri>/api/v1/schedules/1/weekday/0</uri>
    	</direction>
    </cdta-response>			
    
  • Response 404 SHOW
  • < Content-Type: application/json >
    {
    	"status":404,
    	"message":"Not Found"
    }
    
  • Examples
  • Hint: Click on the Example Name to see response in browser.
    Rt 1-Weekday-East
    curl -G "http://api.cdta.org/api/v1/?request=schedules/1/weekday/0" -H "key:<apikey>"
    Rt 905-Weekday-West
    curl -G "http://api.cdta.org/api/v1/?request=schedules/905/weekday/1" -H "key:<apikey>"
    format specified
    curl -G "http://api.cdta.org/api/v1/?request=schedules/1/weekday/0&format=xml" -H "key:<apikey>"
  • Stops

    This method may be used retrieve all the stops for a route and specified direction in the most common order they are stopped at. It may also be used to return all stops that CDTA services in Alphabetically order by Stop Name.

    GET /api/v1/?request=stops/{route_id}/{direction}

    Returns a listing of stops including the id, name and location (lat and long) of the stops.

    • Parameters
    • route_id
      (optional) string Route Identifier.
      direction
      (optional) string Direction Identifier or Direction Name. // if none specified all directions are returned
      key
      (required) string API Access Key.
      format
      (optional) string json (default); xml.
    • Response Fields
    • direction[]
      (required) array Direction identifier array for route, if not specified there will be two (2) directions returned
      stops[]
      (required) array Array of stops for direction, in the most common order of arrival for the route
      stop_id
      (required) string Public Stop Identifier, this should be used as a string since the leading zeros are required to identify a stop
      name
      (required) stringPublic Stop Name
      latitude
      (required) float Geographic coordinate that specifies the north-south position
      longitude
      (required) float Geographic coordinate that specifies the east-west position
      stop_arrial_url
      (required) string uri for stop arrivals
    • All Stops Response-JSON 200 SHOW
    • < Content-Type: application/json >
      {
      	"all" : {
      		"name" : "All Stops",
      		"stops" : [{
      				"stop_id" : "12576",
      				"name" : "10 BRITISH AMERICAN BLVD",
      				"latitude" : "42.7597",
      				"longitude" : "-73.8219",
      				"stop_arrival_uri" : "\/api\/v1\/arrivals\/12576"
      			}, {
      				"stop_id" : "01498",
      				"name" : "100 WATERVLIET AVE",
      				"latitude" : "42.6798",
      				"longitude" : "-73.7831",
      				"stop_arrival_uri" : "\/api\/v1\/arrivals\/01498"
      			}, {
      			...			
      			}, {
      				"stop_id" : "03655",
      				"name" : "WOOD AVE & VAN VRANKEN AVE",
      				"latitude" : "42.8343",
      				"longitude" : "-73.9176",
      				"stop_arrival_uri" : "\/api\/v1\/arrivals\/03655"
      			}
      		],
      		"uri" : "\/api\/v1\/stops\/"
      	}
      }
      
      
    • Specific Route Response-JSON 200 SHOW
    • < Content-Type: application/json >
      {
      	"direction0" : {
      		"name" : "(East) Colonie Center to Downtown Albany",
      		"stops" : [{
      				"stop_id" : "00031",
      				"name" : "WOLF RD & COLONIE CENTER",
      				"latitude" : "42.7114",
      				"longitude" : "-73.8179",
      				"stop_arrival_uri" : "\/api\/v1\/arrivals\/00031"
      			}, {
      				"stop_id" : "10571",
      				"name" : "SAND CREEK RD & KENLYN DR",
      				"latitude" : "42.7141",
      				"longitude" : "-73.8094",
      				"stop_arrival_uri" : "\/api\/v1\/arrivals\/10571"
      			}, {
      				"stop_id" : "10522",
      				"name" : "80 WOLF RD",
      				"latitude" : "42.7149",
      				"longitude" : "-73.8126",
      				"stop_arrival_uri" : "\/api\/v1\/arrivals\/10522"
      			}, {
      			...			
      			}, {
      				"stop_id" : "10502",
      				"name" : "MADISON AVE & GREEN ST",
      				"latitude" : "42.6449",
      				"longitude" : "-73.7524",
      				"stop_arrival_uri" : "\/api\/v1\/arrivals\/10502"
      			}
      		],
      		"uri" : "\/api\/v1\/stops\/1\/0"
      	},
      	"direction1" : {
      		"name" : "(West) Downtown Albany to Colonie Center",
      		"stops" : [{
      				"stop_id" : "03248",
      				"name" : "SUNY PLAZA - BROADWAY STATION",
      				"latitude" : "42.6478",
      				"longitude" : "-73.7504",
      				"stop_arrival_uri" : "\/api\/v1\/arrivals\/03248"
      			}, {
      			...
      			}, {
      				"stop_id" : "00031",
      				"name" : "WOLF RD & COLONIE CENTER",
      				"latitude" : "42.7114",
      				"longitude" : "-73.8179",
      				"stop_arrival_uri" : "\/ap
      				i\/v1\/arrivals\/00031"
      			}
      		],
      		"uri" : "\/api\/v1\/stops\/1\/1"
      	}
      }
      
      
    • Specific Route Response-XML 200 SHOW
    • < Content-Type: application/xml >
      <?xml version="1.0"?>
      <cdta-response>
      	<direction0>
      		<name>(East) Colonie Center to Downtown Albany</name>
      		<stops>
      			<item0>
      				<stop_id>00031</stop_id>
      				<name>WOLF RD & COLONIE CENTER</name>
      				<latitude>42.7114</latitude>
      				<longitude>-73.8179</longitude>
      				<stop_arrival_uri>/api/v1/arrivals/00031</stop_arrival_uri>
      			</item0>
      			<item1>
      				<stop_id>10571</stop_id>
      				<name>SAND CREEK RD & KENLYN DR</name>
      				<latitude>42.7141</latitude>
      				<longitude>-73.8094</longitude>
      				<stop_arrival_uri>/api/v1/arrivals/10571</stop_arrival_uri>
      			</item1>
      			<item2>
      				<stop_id>10522</stop_id>
      				<name>80 WOLF RD</name>
      				<latitude>42.7149</latitude>
      				<longitude>-73.8126</longitude>
      				<stop_arrival_uri>/api/v1/arrivals/10522</stop_arrival_uri>
      			</item2>
      			...
      			<item38>
      				<stop_id>10502</stop_id>
      				<name>MADISON AVE & GREEN ST</name>
      				<latitude>42.6449</latitude>
      				<longitude>-73.7524</longitude>
      				<stop_arrival_uri>/api/v1/arrivals/10502</stop_arrival_uri>
      			</item38>
      		</stops>
      		<uri>/api/v1/stops/1/0</uri>
      	</direction0>
      	<direction1>
      		<name>(West) Downtown Albany to Colonie Center</name>
      		<stops>
      			<item0>
      				<stop_id>03248</stop_id>
      				<name>SUNY PLAZA - BROADWAY STATION</name>
      				<latitude>42.6478</latitude>
      				<longitude>-73.7504</longitude>
      				<stop_arrival_uri>/api/v1/arrivals/03248</stop_arrival_uri>
      			</item0>
      			...
      			<item31>
      				<stop_id>00031</stop_id>
      				<name>WOLF RD & COLONIE CENTER</name>
      				<latitude>42.7114</latitude>
      				<longitude>-73.8179</longitude>
      				<stop_arrival_uri>/api/v1/arrivals/00031</stop_arrival_uri>
      			</item31>
      		</stops>
      		<uri>/api/v1/stops/1/1</uri>
      	</direction1>
      			
      			
      </cdta-response>
      
    • Not Found Response 404 SHOW
    • < Content-Type: application/json >
      {
      	"status":404,
      	"message":"Not Found"
      }
      
    • Examples
    • Hint: Click on the Example Name to see response in browser.
      all stops
      curl -G "http://api.cdta.org/api/v1/?request=stops" -H "key:<apikey>"
      route only
      curl -G "http://api.cdta.org/api/v1/?request=stops/1" -H "key:<apikey>"
      route & direction id
      curl -G "http://api.cdta.org/api/v1/?request=stops/1/0" -H "key:<apikey>"
      route & direction name
      curl -G "http://api.cdta.org/api/v1/?request=stops/1/%28East%29%20Colonie%20Center%20to%20Downtown%20Albany" -H "key:<apikey>"
      format specified
      curl -G "http://api.cdta.org/api/v1/?request=stops/1/1&format=xml" -H "key:<apikey>"

    NearStops

    This method may be used retrieve all the stops that are close to a specific latitude and longitude.

    GET /api/v1/?request=nearstops/{latitude}/{longitude}/{result_count}

    Returns a listing of stops that are within range of a specific latitude and longitude. The stop_id, name, point reference, distance and a listing of routes that service the stop will be returned.

    • Issues
    • Distance
      The current distance is in degrees and is an approximation using the Pythagorean distance formula.
      Distance Feet
      The calculation for the distance in feet is based on the length of degree at a specific latitude. This is currently set the average of 268977.45 for one degree of longitude and 364455.15 for one degree of latitude. Suffice to say the distance in feet is an APPROXIMIATION.
      For miles the lengths are 59.98 for one degree of latitude and 50.94 for one degree of longitude. http://www.csgnetwork.com/degreelenllavcalc.html
    • Parameters
    • latitude
      (required) float latitude of search center.
      longitude
      (requires) float longitude of the search center.
      number_of_items
      (requires) float number of stops to return // if none specified the default is 10.
      key
      (required) string API Access Key.
      format
      (optional) string json (default); xml.
    • Response Fields
    • latitude
      (required) float latitude of search center.
      longitude
      (requires) float longitude of the search center.
      stops[]
      (required) array array of closest stops
      stop_id
      (required) string Public stop identifier, this a string and should be used as one since the proceeding 0's are required.
      name
      (required) string Name of the stop
      latitude
      (required) float Geographic coordinate that specifies the north-south position
      longitude
      (required) float Geographic coordinate that specifies the east-west position
      distance_degrees
      (required) float distance in degrees of stop from search center - approximation. Can be used to find distance in other measuremesnts such as miles (distance_degrees * 59.98) = distance_miles.
      distance_feet
      (required) float distance in feet of stop from search center - approximation. Formula: distance_degrees * ((268977.45 + 364455.15) / 2).
      serviced_by[]
      (required) string array of routes and the direction that service that stop
      route_id
      (required) string route identifier
      direction
      (required) string direction of the route usually cardinal (North, South, East, West) or (Clockwise, Counter-Clockwise)
    • Response-JSON 200 SHOW
    • < Content-Type: application/json >
      {
      	"latitude" : "42.6635",
      	"longitude" : "-73.78373",
      	"stops" : [{
      			"stop_id" : "00882",
      			"name" : "WESTERN AVE & PARTRIDGE ST",
      			"latitude" : "42.6635",
      			"longitude" : "-73.78373",
      			"distance_degrees" : "0.00118000000000507",
      			"distance_feet" : "317.393391001363",
      			"serviced_by" : {
      				"10" : {
      					"route_id" : "10",
      					"direction" : "East"
      				},
      				"11" : {
      					"route_id" : "11",
      					"direction" : "East"
      				},
      				"116" : {
      					"route_id" : "116",
      					"direction" : "South"
      				},
      				"214" : {
      					"route_id" : "214",
      					"direction" : "East"
      				}
      			}
      		}, {
      			"stop_id" : "00884",
      			"name" : "WESTERN AVE & PARTRIDGE ST",
      			"latitude" : "42.6635",
      			"longitude" : "-73.78373",
      			"distance_degrees" : "0.00150003333297015",
      			"distance_feet" : "403.475140817313",
      			"serviced_by" : {
      				"10" : {
      					"route_id" : "10",
      					"direction" : "West"
      				},
      				"11" : {
      					"route_id" : "11",
      					"direction" : "West"
      				},
      				"214" : {
      					"route_id" : "214",
      					"direction" : "West"
      				}
      			}
      		}, 
      		...
      		}, {
      			"stop_id" : "11340",
      			"name" : "ALBANY HIGH SCHOOL",
      			"latitude" : "42.6635",
      			"longitude" : "-73.78373",
      			"distance_degrees" : "0.00337999999999994",
      			"distance_feet" : "909.143780999984",
      			"serviced_by" : {
      				"138" : {
      					"route_id" : "138",
      					"direction" : "East"
      				}
      			}
      		}
      	],
      	"uri" : "\/api\/v1\/nearstops\/42.6635\/-73.78373\/10"
      }
      
    • Response-XML 200 SHOW
    • < Content-Type: application/xml >
      <?xml version="1.0"?>
      <cdta-response>
      	<latitude>42.6635</latitude>
      	<longitude>-73.78373</longitude>
      	<stops>
      		<item0>
      			<stop_id>00882</stop_id>
      			<name>WESTERN AVE & PARTRIDGE ST</name>
      			<latitude>42.6635</latitude>
      			<longitude>-73.78373</longitude>
      			<distance_degrees>0.00118000000000507</distance_degrees>
      			<distance_feet>317.393391001363</distance_feet>
      			<serviced_by>
      				<item10>
      					<route_id>10</route_id>
      					<direction>East</direction>
      				</item10>
      				<item11>
      					<route_id>11</route_id>
      					<direction>East</direction>
      				</item11>
      				<item116>
      					<route_id>116</route_id>
      					<direction>South</direction>
      				</item116>
      				<item214>
      					<route_id>214</route_id>
      					<direction>East</direction>
      				</item214>
      			</serviced_by>
      		</item0>
      		...
      		<item9>
      			<stop_id>11340</stop_id>
      			<name>ALBANY HIGH SCHOOL</name>
      			<latitude>42.6635</latitude>
      			<longitude>-73.78373</longitude>
      			<distance_degrees>0.00337999999999994</distance_degrees>
      			<distance_feet>909.143780999984</distance_feet>
      			<serviced_by>
      				<item138>
      					<route_id>138</route_id>
      					<direction>East</direction>
      				</item138>
      			</serviced_by>
      		</item9>
      	</stops>
      	<uri>/api/v1/nearstops/42.6635/-73.78373/10</uri>
      </cdta-response>
      
    • Response 404 SHOW
    • < Content-Type: application/json >
      {
      	"status":404,
      	"message":"Not Found"
      }
      

    SearchStops

    This method may be used to search for stops based on name or stop id. The method will take a partial search term or stop id and look for that within the name or stop id.

    GET /api/v1/?request=searchstops/{search_term}

    Returns the original search term, the number of items returned and listing of stops that are have the search term or stop id (a number) within the full name or stop id. The stop_id, name, latitude, longitude and a listing of routes that service the stop will be returned. The items will be returned in order of relevance, which is currently in this order "Exact", "Starts With", "Contains". This relevance is not returned with the results.

    • Parameters
    • search_term
      (required) string text or number that is being search for
      key
      (required) string API Access Key.
      format
      (optional) string json (default); xml.
    • Response Fields
    • search_term
      (required) string original search term passed in.
      results_count
      (requires) int number of items returned by the search.
      stops[]
      (required) array array of stops meeting the search criteria
      stop_id
      (required) string Public stop identifier, this a string and should be used as one since the proceeding 0's are required.
      name
      (required) string Name of the stop
      latitude
      (required) float Geographic coordinate that specifies the north-south position
      longitude
      (required) float Geographic coordinate that specifies the east-west position
      serviced_by[]
      (required) string array of routes and the direction that service that stop
      route_id
      (required) string route identifier
      direction
      (required) string direction of the route usually cardinal (North, South, East, West) or (Clockwise, Counter-Clockwise)
    • Response-JSON 200 SHOW
    • < Content-Type: application/json >
      {
      	"search_term" : "state",
      	"results_count" : 73,
      	"stops" : [{
      			"stop_id" : "02657",
      			"name" : "STATE ST & BALLTOWN RD",
      			"latitude" : "42.7714",
      			"longitude" : "-73.894",
      			"serviced_by" : {
      				"355" : {
      					"route_id" : "355",
      					"direction" : "East"
      				}
      			}
      		}, {
      			"stop_id" : "02961",
      			"name" : "STATE ST & BRANDYWINE AVE",
      			"latitude" : "42.8009",
      			"longitude" : "-73.927",
      			"serviced_by" : {
      				"355" : {
      					"route_id" : "355",
      					"direction" : "West"
      				}
      			}
      		}, {
      			"stop_id" : "10207",
      			"name" : "STATE ST & BROADWAY - DOWNTOWN\/TRAIN STATION",
      			"latitude" : "42.8137",
      			"longitude" : "-73.9433",
      			"serviced_by" : {
      				"353" : {
      					"route_id" : "353",
      					"direction" : "East"
      				},
      				"354" : {
      					"route_id" : "354",
      					"direction" : "East"
      				},
      				"355" : {
      					"route_id" : "355",
      					"direction" : "East"
      				},
      				"370" : {
      					"route_id" : "370",
      					"direction" : "East"
      				},
      				"763" : {
      					"route_id" : "763",
      					"direction" : "East"
      				},
      				"905" : {
      					"route_id" : "905",
      					"direction" : "East"
      				}
      			}
      		},
      		...
      		}, {
      			"stop_id" : "10681",
      			"name" : "ROUTE 9W @ NY STATE THRUWAY AUTHORITY",
      			"latitude" : "42.6297",
      			"longitude" : "-73.7775",
      			"serviced_by" : {
      				"719" : {
      					"route_id" : "719",
      					"direction" : "West"
      				}
      			}
      		}
      	],
      	"uri" : "\/api\/v1\/searchstops\/state"
      }		
      
    • Response-XML 200 SHOW
    • < Content-Type: application/xml >
      <?xml version="1.0"?>
      <cdta-response>
      	<search_term>broadway</search_term>
      	<results_count>110</results_count>
      	<stops>
      		<item0>
      			<stop_id>03728</stop_id>
      			<name>BROADWAY & 12TH ST</name>
      			<latitude>42.7947</latitude>
      			<longitude>-73.9731</longitude>
      			<serviced_by>
      				<item351>
      					<route_id>351</route_id>
      					<direction>South</direction>
      				</item351>
      			</serviced_by>
      		</item0>
      		<item1>
      			<stop_id>00078</stop_id>
      			<name>BROADWAY & 13 TH ST</name>
      			<latitude>42.7227</latitude>
      			<longitude>-73.7009</longitude>
      			<serviced_by>
      				<item22>
      					<route_id>22</route_id>
      					<direction>North</direction>
      				</item22>
      			</serviced_by>
      		</item1>
      		<item109>
      			<stop_id>03248</stop_id>
      			<name>SUNYPLAZA - BROADWAY STATION</name>
      			<latitude>42.6478</latitude>
      			<longitude>-73.7504</longitude>
      			<serviced_by>
      				<item1>
      					<route_id>1</route_id>
      					<direction>West</direction>
      				</item1>
      				<item114>
      					<route_id>114</route_id>
      					<direction>East</direction>
      				</item114>
      				<item125>
      					<route_id>125</route_id>
      					<direction>West</direction>
      				</item125>
      				<item13>
      					<route_id>13</route_id>
      					<direction>West</direction>
      				</item13>
      				<item138>
      					<route_id>138</route_id>
      					<direction>West</direction>
      				</item138>
      				<item18>
      					<route_id>18</route_id>
      					<direction>West</direction>
      				</item18>
      				<item182>
      					<route_id>182</route_id>
      					<direction>North</direction>
      				</item182>
      				<item214>
      					<route_id>214</route_id>
      					<direction>West</direction>
      				</item214>
      				<item224>
      					<route_id>224</route_id>
      					<direction>North</direction>
      				</item224>
      				<item712>
      					<route_id>712</route_id>
      					<direction>West</direction>
      				</item712>
      				<item737>
      					<route_id>737</route_id>
      					<direction>West</direction>
      				</item737>
      				<item763>
      					<route_id>763</route_id>
      					<direction>West</direction>
      				</item763>
      				<item814>
      					<route_id>814</route_id>
      					<direction>West</direction>
      				</item814>
      				<item905>
      					<route_id>905</route_id>
      					<direction>West</direction>
      				</item905>
      			</serviced_by>
      		</item109>
      	</stops>
      	<uri>/api/v1/searchstops/broadway</uri>
      </cdta-response>		
      </cdta-response>
      
    • Response 404 SHOW
    • < Content-Type: application/json >
      {
      	"status":404,
      	"message":"Not Found"
      }
      
    • Examples
    • Hint: Click on the Example Name to see response in browser.
      search: state
      curl -G "http://api.cdta.org/api/v1/?request=searchstops/state" -H "key:<apikey>"
      search: stop id
      curl -G "http://api.cdta.org/api/v1/?request=searchstops/0013" -H "key:<apikey>"
      format specified
      curl -G "http://api.cdta.org/api/v1/?request=searchstops/broadway&format=xml" -H "key:<apikey>"
      example search
      Colonie Center
      Crossgates
      SUNY
      Museum

    Arrivals

    This method returns the scheduled or estimated arrivals at a specific stop for different routes.

    GET /api/v1/?request=arrivals/{stop_id}/{number_of_items}

    Returns the scheduled (and in the future real time) arrivals at a specific stop. The arrivals are by route, so if you specify 3 arrivals it will return the next 3 arrivals (if scheduled) for each route that uses that stop.

    • Parameters
    • stop_id
      (required) string Stop Identifier.
      number_of_items
      (optional) string Number of arrivals to return per route // if none specified the default is next 5
      key
      (required) string API Access Key.
      format
      (optional) string json (default); xml.
    • Response Fields
    • stop_id
      (required) string Public Stop Identifier.
      stop_name
      (required) string Name of the stop
      arrivals[]
      (required) array Array of arrivals for the specified stop
      type
      (required) string S : Scheduled, E : Estimated (real time arrival)
      route_id
      (required) string Route identifier
      route_name
      (required) string Route name
      arrival_minutes
      (required) float arrival time in minutes
      arrival_time
      (required) time actual arrival time HH:MM:SS
    • Response-JSON 200 SHOW
    • < Content-Type: application/json >
      {
      	"stop_id" : "10514",
      	"stop_name" : "CENTRAL AVE & NORTHWAY MALL - COLONIE STATION",
      	"arrivals" : [{
      			"type" : "S",
      			"route_id" : "1",
      			"route_name" : "Central Avenue",
      			"arrival_minutes" : "93.0000",
      			"arrival_time" : "04:10:00"
      		}, {
      			"type" : "S",
      			"route_id" : "1",
      			"route_name" : "Central Avenue",
      			"arrival_minutes" : "198.0000",
      			"arrival_time" : "05:55:00"
      		}, {
      		...
      		}, {
      			"type" : "S",
      			"route_id" : "1",
      			"route_name" : "Central Avenue",
      			"arrival_minutes" : "558.0000",
      			"arrival_time" : "11:55:00"
      		}
      	],
      	"uri" : "\/api\/v1\/arrivals\/10514\/10"
      }
      
    • Response-XML 200 SHOW
    • < Content-Type: application/xml >
      <?xml version="1.0"?>
      <cdta-response>
      	<stop_id>10514</stop_id>
      	<stop_name>CENTRAL AVE </stop_name>
      	<arrivals>
      		<item0>
      			<type>S</type>
      			<route_id>1</route_id>
      			<route_name>Central Avenue</route_name>
      			<arrival_minutes>91.0000</arrival_minutes>
      			<arrival_time>04:10:00</arrival_time>
      		</item0>
      		<item1>
      			<type>S</type>
      			<route_id>1</route_id>
      			<route_name>Central Avenue</route_name>
      			<arrival_minutes>196.0000</arrival_minutes>
      			<arrival_time>05:55:00</arrival_time>
      		</item1>
      		...
      		<item9>
      			<type>S</type>
      			<route_id>1</route_id>
      			<route_name>Central Avenue</route_name>
      			<arrival_minutes>556.0000</arrival_minutes>
      			<arrival_time>11:55:00</arrival_time>
      		</item9>
      	</arrivals>
      	<uri>/api/v1/arrivals/10514/10</uri>		
      </cdta-response>
      
    • Response 404 SHOW
    • < Content-Type: application/json >
      {
      	"status":404,
      	"message":"Not Found"
      }
      
    • Examples
    • Hint: Click on the Example Name to see response in browser.
      stop only
      curl -G "http://api.cdta.org/api/v1/?request=arrivals/10514" -H "key:<apikey>"
      stop id & number
      curl -G "http://api.cdta.org/api/v1/?request=arrivals/10514/10" -H "key:<apikey>"
      stop does not exist
      curl -G "http://api.cdta.org/api/v1/?request=arrivals/99999" -H "key:<apikey>"
      format specified
      curl -G "http://api.cdta.org/api/v1/?request=arrivals/10514/20&format=xml" -H "key:<apikey>"

    Alerts

    This method may be used to retrieve all active service alerts for CDTA.

    GET /api/v1/?request=alerts

    Returns the listing of all active service alerts. This will always bring back at least one element, see example response below when there are no current service alerts

    • Parameters
    • key
      (required) string API Access Key.
      format
      (optional) string json (default); xml.
    • Response Fields
    • alerts[]
      (required) array Array of specific alerts
      route_type
      (required) string Could be one of the following (None, Single Route, Multiple Routes, All Routes, All Albany Routes, All Schenectady Routes, All Troy Routes, All Saratoga Routes, Albany Parade Routes, Schenectady Parade Routes, Troy Parade Routes, Specific Event)
      routes
      (required) array array of route id, if a system or region wide alert is specified in the type like "All Routes" or "All Albany Routes" then there will be no listed of routes here.
      header
      (required) string short (less than 100 characters) alert header
      message
      (required) string full alert message
    • Default Response-JSON 200 SHOW
    • < Content-Type: application/json >
      {
      	"alerts":[{
      		"route_type":"None",
      		"routes":[""],
      		"header":"No service alerts",
      		"message":"There are no delays, service interruptions, re-routes or other rider alerts at this time."
      	}],
      	"uri":"\/api\/v1\/alerts"
      }
      
    • Response-JSON 200 SHOW
    • < Content-Type: application/json >
      {
      	"alerts":[{
      		"routes_type":"Multiple Routes",
      		"routes":["6","7","10","12","100","125","138"],
      		"header":"Re-route in Effect due to Pearl St between State St & Sheridan Ave Closed (Car Show) 7am to 3pm on October 12, 2013",
      		"message":"Pearl St between State St & Sheridan Ave Closed (Car Show) 7am to 3pm on October 12, 2013\n\nNorth Pearl St between State St & Sheridan Ave will be closed both directions from 7am to 4pm for the Car Show. Buses that operate from Broadway & Orange 6, 7, 10, 12 will use Broadway to Right State St to regular route. Left from State St onto So Pearl St from State St for 6, 7,100,125, & 138 lines. Lines 100,125,138 will operate Clinton Ave to Broadway to State St & will be reversed on outbound trips."
      	},{
      		"routes_type":"Single Route",	
      		"routes":["85"],
      		"header":"Re-route in Effect due to Construction",
      		"message":"Roadwork on River St between Bond and Dow following reroute for the 85 line: N/B R/Middleburgh, L/6th, L/101st to reg route and will reverse it going S/B"
      	},{
      		"routes_type":"All Routes",	
      		"routes":[""],
      		"header":"No Delays due to Weather Conditions",
      		"message":"AS OF WEDNESDAY OCTOBER 30th, WE ARE RUNNING ON SCHEDULE. ALL ROAD SUPERVISORS ARE REPORTING EVERONE IS REGULAR ROUTE AT THIS TIME, MINOR POWER OUTAGES AND WET ROADS BUT NO DETOURS"
      	}],
      	"uri":"\/api\/v1\/alerts"
      }
      
    • Response-XML 200 SHOW
    • < Content-Type: application/xml >
      <?xml version="1.0"?>
      <cdta-response>
      	<alerts>
      		<item0>
      			<route_type>Multiple Routes</route_type>
      			<routes>
      				<item0>6</item0>
      				<item1>7</item2>
      				<item2>10</item3>
      				<item3>12</item4>
      				<item4>100</item5>
      				<item5>125</item6>
      				<item6>138</item7>
      			</routes>		
      			<header>Re-route in Effect due to Pearl St between State St & Sheridan Ave Closed (Car Show) 7am to 3pm on October 12, 2013 </header>
      			<message>Pearl St between State St & Sheridan Ave Closed (Car Show) 7am to 3pm on October 12, 2013\n\nNorth Pearl St between State St & Sheridan Ave will be closed both directions from 7am to 4pm for the Car Show. Buses that operate from Broadway & Orange 6, 7, 10, 12 will use Broadway to Right State St to regular route. Left from State St onto So Pearl St from State St for 6, 7,100,125, & 138 lines. Lines 100,125,138 will operate Clinton Ave to Broadway to State St & will be reversed on outbound trips.</message>
      		</item0>
      		<item1>
      			<route_type>Single Route</route_type>
      			<routes>
      				<item0>85</item0>
      			</routes>
      			<header>Re-route in Effect due to Construction</header>
      			<message>Roadwork on River St between Bond and Dow following reroute for the 85 line: N/B R/Middleburgh, L/6th, L/101st to reg route and will reverse it going S/B</message>
      		</item1>
      		<item2>
      			<route_type>All Routes</route_type>
      			<routes>
      			</routes>
      			<header>No Delays due to Weather Conditions </header>
      			<message>AS OF WEDNESDAY OCTOBER 30th, WE ARE RUNNING ON SCHEDULE. ALL ROAD SUPERVISORS ARE REPORTING EVERONE IS REGULAR ROUTE AT THIS TIME, MINOR POWER OUTAGES AND WET ROADS BUT NO DETOURS>
      		</item2>		
      	</alerts>
      	<uri>/api/v1/alerts</uri>
      </cdta-response>
      
      • Examples
      • Hint: Click on the Example Name to see response in browser.
        default
        curl -G "http://api.cdta.org/api/v1/?request=alerts" -H "key:<apikey>"
        format specified
        curl -G "http://api.cdta.org/api/v1/?request=alerts&format=xml" -H "key:<apikey>"

    App Start

    This method used to log the application start or retrieve application start information

    POST /api/v1/?request=appstart

    Log an application start for usage tracking purposes

    • Parameters
    • os_name
      (required) string os name and version
      phone_model
      (required) string phone model
      device_id
      (optional) string device identifier
      app_version
      (required) string current version of the application
      latitude
      (optional) string latitude of the device for finding closest stops
      longitude
      (optional) string longitude of the device for finding closest stops
    • Response Fields
    • id
      (required) int row id
      uri
      (required) string uri for get
      type
      (required) string log type: appstart
    • Response-JSON 200 SHOW
    • < Content-Type: application/json >
      {
      	"id":"8",
      	"uri":"\/api\/v1\/appstart\/8",
      	"type":"appstart"
      }
      
    • Response-XML 200 SHOW
    • < Content-Type: application/xml >
      <?xml version="1.0"?>
      <cdta-response>
      	<id>9</id>
      	<uri>/api/v1/appstart/9</uri>
      	<type>appstart</type>
      </cdta-response>
      
      • Examples
      • Hint: Click on the Example Name to see response in browser.
        add record
        curl -d "os_name=ios&phone_model=iphone&device_id=1233356789&app_version=1.0&latitude=72.343434&longitude=42.3242344" "http://api.cdta.org/api/v1/?request=appstart" -H "key:<apikey>"
        format specified
        curl -d "os_name=ios&phone_model=iphone&device_id=1233356789&app_version=1.0&latitude=72.343434&longitude=42.3242344" "http://api.cdta.org/api/v1/?request=appstart&format=xml" -H "key:<apikey>"
    GET /api/v1/?request=appstart/{row_id}

    Returns the information associated with a specific app start record

    • Parameters
    • row_id
      (required) integer Row id for app start record.
      key
      (required) string API Access Key.
      format
      (optional) string json (default); xml.
    • Response Fields
    • id
      (required) string row id
      os_name
      (required) string Operating System of mobile device
      phone_model
      (required) string model of the mobile device
      app_version
      (required) string version of the application
      datetime
      (required) datetime date and time of the record
      uri
      (required) string uri of method
    • Response-JSON 200 SHOW
    • < Content-Type: application/json >
      {
      	"id" : "4",
      	"os_name" : "ios",
      	"phone_model" : "iphone",
      	"device_id" : "123456789",
      	"datetime" : "2013-11-26 11:16:01",
      	"uri" : "\/api\/v1\/appstart\/4"
      }
      
      
    • Response-XML 200 SHOW
    • < Content-Type: application/xml >
      <?xml version="1.0"?>
      <cdta-response>
      	<id>4</id>
      	<os_name>ios</os_name>
      	<phone_model>iphone</phone_model>
      	<app_version>1.0</app_version>
      	<datetime>2013-11-26 11:16:01</datetime>
      	<uri>/api/v1/appstart/4</uri>
      </cdta-response>
      
      • Examples
      • Hint: Click on the Example Name to see response in browser.
        default
        curl -G "http://api.cdta.org/api/v1/?request=appstart/1" -H "key:<apikey>"
        format specified
        curl -G "http://api.cdta.org/api/v1/?request=appstart/1&format=xml" -H "key:<apikey>"

    App Usage

    This method used to log the application usage per screen/view or retrieve application detail usage information

    POST /api/v1/?request=appusage

    Log an specific view/screen within an application for usage tracking purposes

    • Parameters
    • view_name
      (required) string name of view or screen
      view_details
      (required) string details of view for example specific route id, stop id, trip planning details, etc
      device_id
      (optional) string device identifier
    • Response Fields
    • id
      (required) int row id
      uri
      (required) string uri for get
      type
      (required) string log type: appusage
    • Response-JSON 200 SHOW
    • < Content-Type: application/json >
      {
      	"id":"3",
      	"uri":"\/api\/v1\/appusage\/3",
      	"type":"appusage"
      }
      
    • Response-XML 200 SHOW
    • < Content-Type: application/xml >
      <?xml version="1.0"?>
      <cdta-response>
      	<id>1</id>
      	<uri>/api/v1/appusage/1</uri>
      	<type>appusage</type>
      </cdta-response>
      
      • Examples
      • Hint: Click on the Example Name to see response in browser.
        add record
        curl -d "view_name=RouteDetails&view_details=1" "http://api.cdta.org/api/v1/?request=appusage" -H "key:<apikey>"
        format specified
        curl -d "view_name=RouteDetails&view_details=1" "http://api.cdta.org/api/v1/?request=appusage&format=xml" -H "key:<apikey>"
    GET /api/v1/?request=appusage/{row_id}

    Returns the information associated with a specific app usage record

    • Parameters
    • row_id
      (optional) integer Row id for app usage record, if not specified all records are dumped
      key
      (required) string API Access Key.
      format
      (optional) string json (default); xml.
    • Response Parameters
    • id
      (required) string row id
      view
      (required) string name of view or screen
      details
      (required) string details for screen
      datetime
      (required) datetime date and time of the record
      uri
      (required) string uri of method
    • Response-JSON 200 SHOW
    • < Content-Type: application/json >
      {
      	"id":"3",
      	"view":"tripplanner",
      	"details":"start:100 watervliet ave, albany, ny;end:100 state street albany, ny",
      	"datetime":"2013-11-26 13:21:17",
      	"uri":"\/api\/v1\/appusage\/3"
      }
      
      
    • Response-XML 200 SHOW
    • < Content-Type: application/xml >
      <?xml version="1.0"?>
      <cdta-response>
      	<id>3</id>
      	<view>tripplanner</view>
      	<details>start:100 watervliet ave, albany, ny;end:100 state street albany, ny</details>
      	<datetime>2013-11-26 13:21:17</datetime>
      	<uri>/api/v1/appusage/3</uri>
      </cdta-response>
      
      • Examples
      • Hint: Click on the Example Name to see response in browser.
        default
        curl -G "http://api.cdta.org/api/v1/?request=appusage/1" -H "key:<apikey>"
        format specified
        curl -G "http://api.cdta.org/api/v1/?request=appusage/1&format=xml" -H "key:<apikey>"