Skip to content

Commit 65c71ee

Browse files
authored
Https (#11)
* Update HomeController.cs * Update main.go * Update readme.md * Update sample.js * Update Sample.js * Update auth.py * Update main.swift
1 parent b2b1335 commit 65c71ee

7 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎ASP.NET/SampleCode/Controllers/HomeController.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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);

‎Golang/main.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

‎Golang/readme.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
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

1010
APPID := "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
## 測試

‎JavaScript/Sample.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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) {

‎Node.js/sample.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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){

‎Python3/auth.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ def get_auth_header(self):
3434

3535
if __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)

‎Swift/HMAC-Signature/HMAC-Signature/main.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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";
6969
let APP_ID = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"
7070
let APP_KEY = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"
7171

0 commit comments

Comments
 (0)