我正在尝试测试视觉 API,已经将一些图像上传到 Google 云存储,并创建了一个浏览器应用程序来请求云 API 进行处理。
我有一个从 Google 开发者控制台下载的 client_id 文件。其中包含一个 client_id 值,我正在使用它作为我的 API 密钥。
我向以下地址发出请求:
https://content-vision.googleapis.com/v1/images:annotate?alt=json&key=414712345643-cln7htsuv78jr9i64v8v7g6cnhm3ccff.apps.googleusercontent.com
(API 密钥已更改)
并发送请求:
{
"requests": [
{
"image": {
"source": {
"gcsImageUri": "https:\/\/console.cloud.google.com\/m\/cloudstorage\/b\/estoril_test\/o\/AI4C3160.JPG"
}
},
"features": [
{
"type": "LABEL_DETECTION",
"maxResults": 1
}
]
}
]
}
但是我收到了一个错误:
{
"error": {
"code": 400,
"message": "API key not valid. Please pass a valid API key.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developer console API key",
"url": "https://console.developers.google.com/project/414754136843/apiui/credential"
}
]
}
]
}
}
我已经为Cloud Vision API授权了API密钥,那么我做错了什么?我尝试了演示中的curl示例,但是我一直收到
Protocol https not supported or disabled in libcurl
我尝试添加双引号,因为一些研究建议我这样做,但仍然没有运气。