尝试使用 Guzzle 向 SendBird API 发送请求时收到错误消息。
错误信息
"message": "Client error: `POST https://api.sendbird.com/v3/group_channels` resulted in a `400 BAD REQUEST` response:\n{\"message\":\"Not valid JSON body.\",\"code\":400403,\"error\":true}\n",
"exception": "GuzzleHttp\\Exception\\ClientException",
我的代码
$client = new Client([
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer XXXXX',
'Content-Type' => 'application/json',
],
]);
$response = $client->post('https://api.sendbird.com/v3/group_channels', [
'form_params' => [
'user_ids' => [$user_id_1,$user_id_2],
'operator_ids' => [$user_id_1,$user_id_2]
]
]);