此刻我要做的只是记录我试图通过POST调用从Sky Scanner API检索的数据,但出现500错误。关于我在做什么的任何想法在这里?
Btw新程序员
更新:错误400
const KEY = '123';
fetch("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/pricing/v1.0",{
"method": "POST","headers": {
"x-rapidapi-host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com","x-rapidapi-key": `${KEY}`,"content-type": "application/x-www-form-urlencoded"
},body: new URLSearchParams({
"inboundDate": "2019-11-10","cabinClass": "business","children": "0","infants": "0","country": "US","currency": "USD","locale": "en-US","originPlace": "SFO-sky","destinationPlace": "LHR-sky","outboundDate": "2019-11-20","adults": "1"
})
})
.then(response => {
console.log(response);
})
.catch(err => {
console.log(err);
});