js -获取过滤器



我有一个问题。我试图获取一个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)

感谢

尝试像这样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)

最新更新