Go to Metro.net
 

Trip Planner Information Feed

Routes

By default output format is set to xml. JSON and PHP are native array formats.

 

Returns

Route will return a list of all routes names, direction and route ids associated with passed carrier id.

 

JSON Format

{'metadata': {'query_time': '0.0028269290924072 seconds',
	'records_found': 2,
	'request': 'Routes: Carrier ID: 1',
	'request_uri': '\\/tm\\/routes.php?carrier=1&format=json'},
	'routes': {'item': [{'direction': 'N',
		  'id': '1108',
		  'text': 'AMTRAK PACIFIC SURFLINER'},
		 {'direction': 'S',
		  'id': '1109',
		  'text': 'AMTRAK PACIFIC SURFLINER'}]}}

 

XML format

Special characters in the output will be encoded. An index attribute will be returned for any ‘arrayed’ objects.

<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
	<metadata>
		<request>
			Routes: Carrier ID: 1 
		</request>
		<records_found>
			2 
		</records_found>
		<request_uri>
			/tm/routes.php?carrier=1&format=xml 
		</request_uri>
		<query_time>
			0.0020790100097656 seconds 
		</query_time>
	</metadata>
	<routes type="list">
		<item>
			<id>
				1108 
			</id>
			<text>
				AMTRAK PACIFIC SURFLINER 
			</text>
			<direction>
				N 
			</direction>
		</item>
		<item>
			<id>
				1109 
			</id>
			<text>
				AMTRAK PACIFIC SURFLINER 
			</text>
			<direction>
				S 
			</direction>
		</item>
	</routes>
</root>

 

Usage

# REQUIRED PARAMETERS: carrier id, apikey
http://developer.metro.net/tm/routes.php?apikey=1-2-3-4-5&carrier=63

# OPTIONAL: SPECIFY FORMAT 
http://developer.metro.net/tm/routes.php?apikey=1-2-3-4-5&carrier=63&format=xml 
http://developer.metro.net/tm/routes.php?apikey=1-2-3-4-5&carrier=63&format=json 
http://developer.metro.net/tm/routes.php?apikey=1-2-3-4-5&carrier=63&format=php


User Contributed Notes

Please Login (or Sign Up) to leave a comment