laravel-5 - 客户端错误:`POST { "error": { "code": 400, "message": "One of content, or gcs_content_uri must be set.", "status": "INVALID (truncated
问题描述
我尝试使用 GuzzleHttp\Client 从 laravel 调用 post api。但是我们尝试以不同的方式 tp 传递 api 密钥,但如果我在 url 中附加 API 密钥则不会得到输出,然后我得到这个结果。
//intiate client
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://language.googleapis.com/',
]);
//api call for get data entitiwise
$response = $client->request('POST','/v1/documents:analyzeEntities?key=' . $apiKey, $finalData);
解决方案
There is no problem with your api key. You have to set either 'content' or 'gcsContentUri' in your request: https://cloud.google.com/natural-language/docs/reference/rest/v1/documents#Document
推荐阅读
- c# - 如何将嵌套的 JSON 数据传递到 C# 中的 API 端点?
- azure - 如何通过 ARM 模板设置 Azure App Service Stack 和 Platform?
- r - 使用许多变量运行回归并尝试每种组合
- amazon-web-services - 如何识别beantalk aws app Django中消耗高内存的进程
- java - 扫描 BLE 设备后未调用 Android BLE Scan Callback
- facebook - 像素事件设置问题
- java - 如何在 Micronaut 应用程序中使用 mongo java 驱动程序将实际查询记录到 MongoDB
- swift - 无法在同一目标中调用从 Swift 中返回 Swift 枚举的 Obj-C 方法
- vba - VBA Access If 语句不包含某个字符
- vue.js - 在 ASP.NET Core 中访问客户端 IP 地址