我怎样才能获取《部落冲突》API?
How can I fetch Clash Of Clans API?
我正在尝试用部落冲突制作一个不和谐的机器人 api。但是我收到一条奇怪的错误消息。谢谢
错误信息:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>v1/clans/LYVVC9JQQ</Key><RequestId>67H6BCRSJ41W6K6X</RequestId><HostId>mPhpqkXy1qKENdOnt+CPhfQn4rK0hGhaMxaLq9q21Ehtbs/CMzSgqHy9TA6L7hii0PY9+Lo2rzg=</HostId></Error>
async function getClashofClansAPi() {
let clashofClansAPI = await fetch(`https://developer.clashofclans.com/v1/clans/LYVVC9JQQ`)
let cocApi = await clashofClansAPI.text()
console.log(cocApi)
}
getClashofClansAPi()
API URL 是 api.clashofclans.com
并且您的授权 header 中也缺少 API KEY,除非出于安全目的将其删除
Clash of Clans API uses JSON Web Tokens for authorizing the requests.
Tokens are created by developers on My Account page and must be passed
in every API request in Authorization HTTP header using Bearer
authentication scheme. Correct Authorization header looks like this:
"Authorization: Bearer API_TOKEN".
请求url应该是https://api.clashofclans.com/v1/clans/%232Q8GRY8LQ
请记住,主题标签(例如#2PP)应替换为 %23,
下次请正确阅读《部落冲突》API文档。
我正在尝试用部落冲突制作一个不和谐的机器人 api。但是我收到一条奇怪的错误消息。谢谢
错误信息:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>v1/clans/LYVVC9JQQ</Key><RequestId>67H6BCRSJ41W6K6X</RequestId><HostId>mPhpqkXy1qKENdOnt+CPhfQn4rK0hGhaMxaLq9q21Ehtbs/CMzSgqHy9TA6L7hii0PY9+Lo2rzg=</HostId></Error>
async function getClashofClansAPi() {
let clashofClansAPI = await fetch(`https://developer.clashofclans.com/v1/clans/LYVVC9JQQ`)
let cocApi = await clashofClansAPI.text()
console.log(cocApi)
}
getClashofClansAPi()
API URL 是 api.clashofclans.com
并且您的授权 header 中也缺少 API KEY,除非出于安全目的将其删除
Clash of Clans API uses JSON Web Tokens for authorizing the requests. Tokens are created by developers on My Account page and must be passed in every API request in Authorization HTTP header using Bearer authentication scheme. Correct Authorization header looks like this: "Authorization: Bearer API_TOKEN".
请求url应该是https://api.clashofclans.com/v1/clans/%232Q8GRY8LQ
请记住,主题标签(例如#2PP)应替换为 %23, 下次请正确阅读《部落冲突》API文档。