我有个问题。我正在尝试获取一个API,但是有一条错误消息说:
必须至少存在一个筛选参数。
我在谷歌上发现了一些东西,但都没有用。我的代码如下所示:
let api = await fetch("https://api.clashofclans.com/v1/clans/#2Q8GRY8LQ", {
method: `GET`,
headers: new Headers({
'Authorization': `Bearer ${API_TOKEN}`,
})
})
let apiJSON = await api.json()
console.log(apiJSON)
谢谢
发布于 2022-05-04 15:23:56
试着像这样对氏族标签进行encodeURIComponent:
let api = await fetch(`https://api.clashofclans.com/v1/clans/${encodeURIComponent("#2Q8GRY8LQ")}`, {
method: `GET`,
headers: new Headers({
'Authorization': `Bearer ${API_TOKEN}`,
})
})
let apiJSON = await api.json()
console.log(apiJSON)https://stackoverflow.com/questions/72115396
复制相似问题