我无法使用谷歌搜索 api

问题描述 投票:0回答:0

我现在开始使用 api,并且我有一个特定的项目,我需要在其中使用 google search api,但是我遇到了问题,我正在尝试使用 javascript,但我没有取得进展。 错误:“无法加载资源:服务器响应状态为 400()”

我用了fetch and then方法,让服务器把答案发给我,但是没用...

const url = 
https://www.googleapis.com/customsearch/v1?key=${API_KEY}&cx=${SEARCH_ENGINE_ID}&q=${SEARCH_QUERY}
; fetch(url).then(resposta =>{ console.log(resposta.json()) });

javascript http-status-code-404
© www.soinside.com 2019 - 2024. All rights reserved.