Google Cloud Vision API“ PERMISSION_DENIED”

Bin*_*hew 5 google-cloud-platform google-cloud-vision

我正在尝试使用Google Cloud Vision API(测试版),并且返回“权限被拒绝”消息。但是为该项目启用了“ Cloud Vision API”。任何帮助表示赞赏。

Google API Explorer的错误详细信息

403 OK

- Show headers -

{
 "error": {
  "code": 403,
  "message": "Project has not activated the vision.googleapis.com API. Please enable the API for project google.com:apisexplorerconsole (#292824132082).",
  "status": "PERMISSION_DENIED",
  "details": [
   {
    "@type": "type.googleapis.com/google.rpc.Help",
    "links": [
     {
      "description": "Google developers console API activation",
      "url": "https://console.developers.google.com/project/292824132082/apiui/api"
     }
    ]
   }
  ]
 }
}
Run Code Online (Sandbox Code Playgroud)

Sim*_*ier 3

您应该首先使用 CURL 请求而不是 API 资源管理器或您最喜欢的编程语言:

curl -v -k -s -H“内容类型:application/json” https://vision.googleapis.com/v1/images:annotate?key=put_your_browser_secret_key_here --data-binary @ put_your_req.json > result.json

{
"requests":[
{
  "image":{
    "content":"put_your_encoded_base64_image_content"
  },
  "features":[
    {
      "type":"LABEL_DETECTION",
      "maxResults":4
    }
  ]
}
]
}
Run Code Online (Sandbox Code Playgroud)

您可能已经知道:

base64 your_image > your_encoded_base64_image_content
Run Code Online (Sandbox Code Playgroud)

希望有帮助,我不知道为什么 API 资源管理器有限制。