Я пытаюсь загрузить файлы через curl с помощью ключа API. Я создал ключ API без ограничений приложения, но с ограничениями API только для хранилища:
Однако, когда я пытаюсь загрузить файл с помощью curl, я получаю такой ответ:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "ipRefererBlocked",
"message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.",
"extendedHelp": "https://console.developers.google.com"
}
],
"code": 403,
"message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed."
}
}
Я уверен, что использую правильный ключ API. У меня есть только один, и если я сделаю запрос и немного подожду, «Общее использование (последние 30 дней)» на странице конфигурации ключа возрастет на единицу. Если я не интерпретирую это неправильно, сообщение об ошибке просто не точно. Я выбрал «Нет» в разделе «Приложения». Я пытался сделать другие ключи, но мне не повезло.
Вот моя команда curl
curl -X POST --data-binary @$file_name \
-H "Content-Type: application/tar" \
-H "Content-Encoding: gzip" \
"https://www.googleapis.com/upload/storage/v1/b/my_bucket_name/o?uploadType=media&name=$object_name&key=$gcp_api_key"
Есть идеи, что может быть не так?