我正在開發一個 android 應用程式來檢查 PNR 狀態和座位可用性。那么是否有任何公共 api 來獲取這些資訊?
我嘗試了許多 API,但大多數都不起作用。
uj5u.com熱心網友回復:
您是否嘗試過https://rapidapi.com/IRCTCAPI/api/irctc1?
他們也有一些示例,
const axios = require("axios");
const options = {
method: 'GET',
url: 'https://irctc1.p.rapidapi.com/api/v1/getPNRStatus',
params: {pnrNumber: 'xxxxxxxxxx'},
headers: {
'X-RapidAPI-Host': 'irctc1.p.rapidapi.com',
'X-RapidAPI-Key': 'YOUR KEY'
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
注意請在X-RapidAPI-Key中使用您的密鑰
除了 PNR 和座位可用性之外,它們還有一些更有用的 API。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/480663.html