WS_Market


Click here for a complete list of operations.

getTrainLines

以起站/終站POIID、日期、(或火車種類)來查詢班次(適用於火車、高鐵、飛機)
傳入參數
參數名稱參數型態參數說明
nCategoryIDint交通工具類別
nDepartPOIIDint起站之POIID
nArrivalPOIIDint到站之POIID
nDateTypeint日期型態代碼
種類一般時段假日時段每日行駛星期一星期二星期三星期四星期五星期六星期日
代碼12311121314151617
nTrainTypeint火車種類(高鐵、飛機可忽略,填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; // 普通

參數輸入範例
參數
nCategoryID1104
nDepartPOIID552459
nArrivalPOIID553815
nDateType1
nTrainType4

回傳格式
回傳值說明
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>