WS_Market
Click here for a complete list of operations.
getTrainLines
以起站/終站POIID、日期、(或火車種類)來查詢班次(適用於火車、高鐵、飛機)
傳入參數
參數名稱 | 參數型態 | 參數說明 | ||||||||||||||||||||||
nCategoryID | int | 交通工具類別 | ||||||||||||||||||||||
nDepartPOIID | int | 起站之POIID | ||||||||||||||||||||||
nArrivalPOIID | int | 到站之POIID | ||||||||||||||||||||||
nDateType | int | 日期型態代碼
| ||||||||||||||||||||||
nTrainType | int | 火車種類(高鐵、飛機可忽略,填0) 火車車種為bitmask的值,車種mask值參照如下 int TRAIN_TYPE_MASK_ZIQIANG = 0x01; // 自強 int TRAIN_TYPE_MASK_JUGUANG = 0x02; // 莒光 int TRAIN_TYPE_MASK_FUSHING = 0x04; // 復興/區間 int TRAIN_TYPE_MASK_NORMAL = 0x08; // 普通 |
參數輸入範例
參數 | 值 |
nCategoryID | 1104 |
nDepartPOIID | 552459 |
nArrivalPOIID | 553815 |
nDateType | 1 |
nTrainType | 4 |
回傳格式
回傳值 | 說明 |
RouteID | 班次routeID |
name | 班次名稱 |
type | 火車種類 |
stime | 起站時間 |
etime | 終站時間 |
DateTypeID | 日期型態代碼 |
price | 價格 |
回傳範例
[{"View_Lines":[{"RouteID":62711,"name":"1846-新竹-九讚頭","type":3,"stime":389,"etime":393,"DateTypeID":1,"price":15},{"RouteID":62630,"name":"1834-新竹-內灣","type":3,"stime":1066,"etime":1070,"DateTypeID":1,"price":15},{"RouteID":62712,"name":"1848-新竹-九讚頭","type":3,"stime":1244,"etime":1248,"DateTypeID":1,"price":15}]}]
Test
The test form is only available for requests from the local machine.SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.
POST /WS_Market.asmx HTTP/1.1 Host: transittw.localking.com.tw Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://www.gotcha.com.tw/WS_Transit/getTrainLines" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <AuthHeaderMarket xmlns="http://www.gotcha.com.tw/WS_Transit"> <Username>string</Username> <HashKey>string</HashKey> <Password>string</Password> </AuthHeaderMarket> </soap:Header> <soap:Body> <getTrainLines xmlns="http://www.gotcha.com.tw/WS_Transit"> <nCategoryID>int</nCategoryID> <nDepartPOIID>int</nDepartPOIID> <nArrivalPOIID>int</nArrivalPOIID> <nDateType>int</nDateType> <nTrainType>int</nTrainType> </getTrainLines> </soap:Body> </soap:Envelope>
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <getTrainLinesResponse xmlns="http://www.gotcha.com.tw/WS_Transit"> <getTrainLinesResult>string</getTrainLinesResult> </getTrainLinesResponse> </soap:Body> </soap:Envelope>
SOAP 1.2
The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.
POST /WS_Market.asmx HTTP/1.1 Host: transittw.localking.com.tw Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Header> <AuthHeaderMarket xmlns="http://www.gotcha.com.tw/WS_Transit"> <Username>string</Username> <HashKey>string</HashKey> <Password>string</Password> </AuthHeaderMarket> </soap12:Header> <soap12:Body> <getTrainLines xmlns="http://www.gotcha.com.tw/WS_Transit"> <nCategoryID>int</nCategoryID> <nDepartPOIID>int</nDepartPOIID> <nArrivalPOIID>int</nArrivalPOIID> <nDateType>int</nDateType> <nTrainType>int</nTrainType> </getTrainLines> </soap12:Body> </soap12:Envelope>
HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <getTrainLinesResponse xmlns="http://www.gotcha.com.tw/WS_Transit"> <getTrainLinesResult>string</getTrainLinesResult> </getTrainLinesResponse> </soap12:Body> </soap12:Envelope>