客户端错误:`POST {“错误”:{“代码”:400,“消息”:“必须设置一个内容,或gcs_content_uri。”,“状态”:“无效(已截断)>

问题描述 投票:0回答:1

[我尝试使用GuzzleHttp \ Client从laravel调用post api,但是我们尝试以其他方式通过tp pass 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);

我尝试使用GuzzleHttp \ Client从laravel调用post api,但是我们尝试以其他方式通过tp pass api密钥,但是如果我在URL中附加API密钥,则不会获得输出,那么我会得到此结果。 //邀请客户$ ...

laravel-5.4 google-natural-language
1个回答
0
投票

您的api密钥没有问题。您必须在请求中设置'content'或'gcsContentUri':https://cloud.google.com/natural-language/docs/reference/rest/v1/documents#Document

© www.soinside.com 2019 - 2024. All rights reserved.