http://www.tgels.com:8080/restapi/deals/airfares/list.xml
http://www.tgels.com:8080/restapi/deals/airfares/list.json
http operation: GET
Formats: xml, json
Parameters:
A key-value pair of the following:
key: fromairport
value: an airport code
type: String
required: optional
key: toairport
value: an airport code
type: String
required: optional
key: site
value: a site name of form, Spirit.com, Southwest.com, Delta.com, USAir.com, AA.com, Continental.com, Airtran.com, etc.
type: String
required: optional
key: price
value: > 0
type: float
required: optional
key: page
value: >= 0
type: int
required: optional
Returns:
Returns a list of deals in json or xml or html format as requested. If no parameters are supplied, then the first page all available deals is returned. The number of pages, page size, page number is returned so that you can iterate through the deals. The response is in XML or JSON or html format depending on how you suffix the identifer.
Response in xml format:
<restapi>
<name>tgels_restapi</name>
<version>1.0</version>
<request>
<name>/deals/airfares/list.xml</name>
<parameters>fromairport=sfo&toairport=lax</parameters>
<userid>nn1</userid>
</request>
<response>
<data class="deals">
<pages>1</pages>
<pagesize>15</pagesize>
<page>0</page>
<rows>
<deal>
<id>142678</id>
<found>2009-3-19</found>
<fromairport>sfo</fromairport>
<toairport>lax</toairport>
<fromcity>San Francisco</fromcity>
<tocity>Los Angeles</tocity>
<url>http://www.tgels.com:8080/restapi/deals/airfares/list.jsp?from=sfo&to=lax&id=142678&price=0.0</url>
<price>0.0</price>
<travelperiod>null</travelperiod>
<currency>null</currency>
<advancedays>0</advancedays>
<multiple>0</multiple>
<username>null</username>
<userid>null</userid>
<oneway>true</oneway>
<business>false</business>
<first>false</first>
<ambiguous>false</ambiguous>
</deal>
</rows>
</data>
<date>3/20/2009</date>
<status class="ok">
<msg>Ok</msg>
</status>
</response>
</restapi>
The <request> element contains sub elements <name> which names the request,
<parameters> used to filter the response, <userid> making the request. The <response> element contains elements <data> which has an attribute class which describes the type of data being returned. If the class type is Deals, then the response is rows of Deal. A Deal is a sale fare containing elements <id><found><fromairport><toairport>, etc.
Response in json format:
{"restapi":{"name":"tgels_restapi","version":1,"request":{"name":"\/deals\/airfares\/list.json","parameters":"fromairport=sfo&toairport=lax","userid":"nn1"},"response":{"data":{"@class":"deals","pages":1,"pagesize":15,"page":0,"rows":{"deal":[{"id":142678,"found":"2009-3-19","fromairport":"sfo","toairport":"lax","fromcity":"San Francisco","tocity":"Los Angeles","url":"http:\/\/www.tgels.com:8080\/restapi\/deals\/airfares\/list.jsp?from=sfo&to=lax&id=142678&price=0.0","price":0,"travelperiod":"null","currency":"null","advancedays":0,"multiple":0,"username":"null","userid":"null","oneway":true,"business":false,"first":false,"ambiguous":false},{"id":142683,"found":"2009-3-19","fromairport":"sfo","toairport":"lax","fromcity":"San Francisco","tocity":"Los Angeles","url":"http:\/\/www.tgels.com:8080\/restapi\/deals\/airfares\/list.jsp?from=sfo&to=lax&id=142683&price=1.0","price":1,"travelperiod":"null","currency":"null","advancedays":0,"multiple":0,"username":"null","userid":"nn1","oneway":true,"business":true,"first":true,"ambiguous":false},{"id":140318,"found":"2009-3-10","fromairport":"lax","toairport":"sfo","fromcity":"Los Angeles","tocity":"San Francisco","url":"http:\/\/www.tgels.com:8080\/restapi\/deals\/airfares\/list.jsp?from=lax&to=sfo&id=140318&price=47.0","price":47,"travelperiod":"null","currency":"","advancedays":21,"multiple":0,"username":"null","oneway":true,"business":false,"first":false,"ambiguous":false},{"id":134162,"found":"2009-3-4","fromairport":"sfo","toairport":"lax","fromcity":"San Francisco","tocity":"Los Angeles","url":"http:\/\/www.tgels.com:8080\/restapi\/deals\/airfares\/list.jsp?from=sfo&to=lax&id=134162&price=49.0","price":49,"travelperiod":"null","currency":"","advancedays":0,"multiple":0,"username":"null","oneway":true,"business":false,"first":false,"ambiguous":false},{"id":140375,"found":"2009-3-10","fromairport":"lax","toairport":"sfo","fromcity":"Los Angeles","tocity":"San Francisco","url":"http:\/\/www.tgels.com:8080\/restapi\/deals\/airfares\/list.jsp?from=lax&to=sfo&id=140375&price=109.0","price":109,"travelperiod":"null","currency":"","advancedays":21,"multiple":0,"username":"null","oneway":true,"business":false,"first":false,"ambiguous":false}]}},"date":"3\/20\/2009","status":{"@class":"ok","msg":"ok"}}}}
Example:
You can give this a try using a browser or the example
TgelsRestApi application:
With a browser type/click on below URL:
http://www.tgels.com:8080/restapi/deals/airfares/list.xml?fromairport=sfo&toairport=lax
http://www.tgels.com:8080/restapi/deals/airfares/list.json?fromairport=sfo&toairport=lax
It will prompt you for a login/password, please enter your tgels login id/passwd.
You can also install/run the
library code to try this out.