我尝试在exchange rate API中使用我的访问密钥,但收到错误消息。error: Object { code: "missing_access_key", message: "You have not supplied an API Access Key. [Required format: access_key=YOUR_ACCESS_KEY]" }
代码片段i JS。
const API_url = "https://api.exchangeratesapi.io/v1/latest? access_key=[MyApiKey]";
async function currency(){
const res = await fetch(API_url);
const data = await res.json();
console.log(data);
}
currency();
1条答案
按热度按时间col17t5w1#
发布API文档中提到的代码片段。
API密钥在头中发送,在代码片段中,它在GET请求的查询参数中发送。