I'm trying to use the Google Vision API. I'm following getting started guide:
Made JSON file with settings:
{
"requests":[
{
"image":{
"content":"my base64-encoded data"
},
"features":[
{
"type":"LABEL_DETECTION",
"maxResults":5
}
]
}
]
}
Sent request with curl
:
$ curl -v -k -s -H "Content-Type: application/json" https://vision.googleapis.com/v1/images:annotate?key=my_browser_key --data-binary @path_to_file.json
After that I got response:
{
"error": {
"code": 403,
"message": "Requests from referer \u003cempty\u003e are blocked.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developer console API key",
"url": "https://console.developers.google.com/project/***********/apiui/credential"
}
]
}
]
}
}
\u003cempty\u003e means <empty>
Any ideas? Somebody have the same problem?
Did you specify a list of valid referers in the "Accept requests from these HTTP referrers" box shown on that page? If you did you'll probably have to specify one of those:
curl --referer https://yourwebsite.com/ ...
Or just disable the referer check if you don't need it.