我正在使用 Youtube Data API 并尝试获取聊天消息,为此我必须提供lifeChatId
和part
参数
我的代码
$guzzle_client = new Client();
$res = $guzzle_client->request('GET', 'https://www.googleapis.com/youtube/v3/liveChat/messages',
[
'liveChatId' => $broadcastsResponse['modelData']['snippet']['liveChatId'],
'part' => 'id,snippet'
]
);
我收到错误
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required parameter: liveChatId",
"locationType": "parameter",
"location": "liveChatId"
},
{
"domain": "global",
"reason": "required",
"message": "Required parameter: part",
"locationType": "parameter",
"location": "part"
}
],
"code": 400,
"message": "Required parameter: liveChatId"
}
}
但我确定我提供了两个必需的参数。这个 var_dump 写在 guzzle 请求之前
var_dump([
'liveChatId' => $broadcastsResponse['modelData']['snippet']['liveChatId'],
'part' => 'id,snippet'
]);)
返回
array(2) {
["liveChatId"]=>
string(20) "Cg0KC2hRYmU3akNyaXBV"
["part"]=>
string(10) "id,snippet"
}
知道为什么我会收到这样的错误吗?