google-translate - Google Translation API 的 Rest API 请求

标签 google-translate google-translation-api

我对 Google Translation API 的 Rest API 请求有问题

我的POST方法是https://translation.googleapis.com/language/translate/v2?key=MY_KEY

但我收到错误

{
    "error": {
        "code": 400,
        "message": "API Key not found. Please pass a valid API key.",
        "errors": [
        {
            "message": "API Key not found. Please pass a valid API key.",
            "domain": "global",
            "reason": "badRequest"
        }
        ],
        "status": "INVALID_ARGUMENT"
    }
}

请帮助我了解问题出在哪里。

最佳答案

您可能想尝试从 one of the samples 开始而不是尝试构建自己的客户端库或使用 REST 进行 get/POST。如果您必须使用 REST,以下示例可能会有所帮助:

https://translation.googleapis.com/language/translate/v2?key=your-key-here&q=cheese&target=es

将 API key 替换为您已启用翻译 API 访问权限的 key 。

关于google-translate - Google Translation API 的 Rest API 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46149584/

相关文章:

vb.net - 谷歌翻译 API 身份验证

google-api - Google Translate API(付费)与 Google Translate API(免费)?

css - 需要帮助设置 Google 翻译按钮的样式

html - 谷歌翻译,翻译="no"

python - googletrans 未完全从英语翻译成意大利语

python - googletrans 停止将所有语言检测为英语

python - google.auth.exceptions.DefaultCredentialsError :

Android Studio : Duplicate files copied in APK project. 属性

php - 谷歌翻译 API 服务器端

swift - 来自 swift 的 Appspot.com API