我目前的任務是訪問來自交通部QCMobile API的數據,位於here。訪問QCMobile API
我已經做了一個帳戶,並獲得了我的鑰匙。我試過通過Ajax調用,Node的Request和https模塊來訪問它,現在我只是試圖通過Curl獲得響應。
每當我嘗試訪問它時,我都會得到同樣的錯誤:錯誤403,禁止。
我的URL表現爲正常形成,因爲在這裏看到:
https://mobile.fmcsa.dot.gov/qc/services/carriers/44110/basics?webKey=xxxx
當我從節點或從Ajax調用運行它,我只得到403,故宮。
這裏是我的相關節點代碼:
this.url = 'https://mobile.fmcsa.dot.gov/qc/services/carriers/' + dotNumber + '/basics' + '?webKey=' + this.webkey;
this.options = {
method: 'GET',
uri: this.url,
};
this.getDoTData = function() {
request(this.options)
.then(function (response) {
// Request was successful, use the response object at will
console.log(response);
})
.catch(function (err) {
// Something bad happened, handle the error
console.log(err);
});
}
當我通過捲曲運行它,我會得到相同的403與一些額外的細節:
curl: (56) SSLRead() return error -9806
我想知道如果任何人有任何想法至於如果我不正確地訪問這個API。似乎沒有太多的文檔,他們網站上可以提交技術問題的頁面似乎已被打破。
感謝您的任何見解。
嗯,還好。我覺得有什麼問題。謝謝你讓我知道! –
更新:它現在可用! –