我现在要做的就是记录我试图通过 POST 调用从 Sky Scanner API 检索的数据,但我收到错误 500。关于我在这里做错了什么有什么想法吗?
顺便说一句,新程序员
更新:错误 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);
});