File tree Expand file tree Collapse file tree
ASP.NET/SampleCode/Controllers
Swift/HMAC-Signature/HMAC-Signature Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ private ActionResult CallAPIByHMAC()
3737
3838 List < RailStation > Data = new List < RailStation > ( ) ;
3939 //欲呼叫之API網址(此範例為台鐵車站資料)
40- var APIUrl = "http ://ptx.transportdata.tw/MOTC/v2/Rail/TRA/Station?$top=10&$format=JSON" ;
40+ var APIUrl = "https ://ptx.transportdata.tw/MOTC/v2/Rail/TRA/Station?$top=10&$format=JSON" ;
4141 string Result = string . Empty ;
4242
4343 using ( HttpClient Client = new HttpClient ( new HttpClientHandler { AutomaticDecompression = DecompressionMethods . GZip } ) )
@@ -80,7 +80,7 @@ private ActionResult CallAPIByTicket()
8080 var ticket = UserData . ticket ;
8181 ViewBag . ticket = ticket ;
8282 //欲呼叫之API網址(此範例為台鐵車站資料)
83- var APIUrl = "http ://ptx.transportdata.tw:80/MOTC/Rail/TRA/Station?ticket=" + ticket ;
83+ var APIUrl = "https ://ptx.transportdata.tw:80/MOTC/Rail/TRA/Station?ticket=" + ticket ;
8484 string result = wc . DownloadString ( APIUrl ) ;
8585 Data = JsonConvert . DeserializeObject < List < RailStation > > ( result ) ;
8686 return View ( Data ) ;
Original file line number Diff line number Diff line change @@ -13,5 +13,5 @@ func main(){
1313 }
1414
1515 //usage
16- fmt .Println (ptx .Get ("http ://ptx.transportdata.tw/MOTC/v2/Rail/TRA/Station?$top=10&$format=JSON" ))
16+ fmt .Println (ptx .Get ("https ://ptx.transportdata.tw/MOTC/v2/Rail/TRA/Station?$top=10&$format=JSON" ))
1717}
Original file line number Diff line number Diff line change 44給予立即需要使用 ptx platform api 的開發者:
55``` go
66// 從 local 或 GitHub 上獲取這個 Golang Wrapper
7- // 若您從 GitHub 上獲取這個專案,請記得使用 go get http ://....../lib
7+ // 若您從 GitHub 上獲取這個專案,請記得使用 go get https ://....../lib
88// import "########/lib"
99
1010APPID := " FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF" ;
@@ -17,7 +17,7 @@ ptx := lib.PTXService{
1717}
1818
1919// 調用 ptx.Get(url) 即可獲得資料
20- fmt.Println (ptx.Get (" http ://ptx.transportdata.tw/MOTC/v2/Rail/TRA/Station?$top=10&$format=JSON" ))
20+ fmt.Println (ptx.Get (" https ://ptx.transportdata.tw/MOTC/v2/Rail/TRA/Station?$top=10&$format=JSON" ))
2121```
2222
2323## 測試
Original file line number Diff line number Diff line change 11$ ( function ( ) {
22 $ . ajax ( {
33 type : 'GET' ,
4- url : 'http ://ptx.transportdata.tw/MOTC/v2/Rail/TRA/Station?$top=10&$format=JSON' , //欲呼叫之API網址(此範例為台鐵車站資料)
4+ url : 'https ://ptx.transportdata.tw/MOTC/v2/Rail/TRA/Station?$top=10&$format=JSON' , //欲呼叫之API網址(此範例為台鐵車站資料)
55 dataType : 'json' ,
66 headers : GetAuthorizationHeader ( ) ,
77 success : function ( Data ) {
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const getAuthorizationHeader = function() {
1515 return { 'Authorization' : Authorization , 'X-Date' : GMTString } ;
1616}
1717
18- axios . get ( 'http ://ptx.transportdata.tw/MOTC/v2/Rail/TRA/Station?$top=10&$format=JSON' , { // 欲呼叫之API網址(此範例為台鐵車站資料)
18+ axios . get ( 'https ://ptx.transportdata.tw/MOTC/v2/Rail/TRA/Station?$top=10&$format=JSON' , { // 欲呼叫之API網址(此範例為台鐵車站資料)
1919 headers : getAuthorizationHeader ( ) ,
2020} )
2121 . then ( function ( response ) {
Original file line number Diff line number Diff line change @@ -34,5 +34,5 @@ def get_auth_header(self):
3434
3535if __name__ == '__main__' :
3636 a = Auth (app_id , app_key )
37- response = request ('get' , 'http ://ptx.transportdata.tw/MOTC/v2/Bus/Stop/City/Taipei?$top=30&$format=JSON' , headers = a .get_auth_header ())
38- pprint (response .content )
37+ response = request ('get' , 'https ://ptx.transportdata.tw/MOTC/v2/Bus/Stop/City/Taipei?$top=30&$format=JSON' , headers = a .get_auth_header ())
38+ pprint (response .content )
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ func getServerTime() -> String {
6565 return dateFormater. string ( from: Date ( ) )
6666}
6767
68- let APIUrl = " http ://ptx.transportdata.tw/MOTC/v2/Rail/TRA/Station?$top=10&$format=JSON" ;
68+ let APIUrl = " https ://ptx.transportdata.tw/MOTC/v2/Rail/TRA/Station?$top=10&$format=JSON" ;
6969let APP_ID = " FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF "
7070let APP_KEY = " FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF "
7171
You can’t perform that action at this time.
0 commit comments