You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用Zoom API创建网络研讨会POST请求返回300错误如何解决?

问题原因

  • 参数格式不符合封装包要求:你使用的Zoom API封装包的doRequest方法第四个参数要求传入关联数组格式的请求体,包内部会自动完成JSON编码、设置Content-Type: application/json头的操作。你提前将数组编码为JSON字符串传入,封装包会再次对字符串做编码处理,最终发送的请求体是被双重转义的字符串,并非Zoom要求的JSON对象,因此返回300错误。
  • 冗余编码操作无意义:你编写的json_encode(json_decode(json_encode($bodyparam)))属于完全无效的冗余操作,没有任何实际作用,反而可能在特殊字符场景下引入编码错误。
  • 多余的查询参数:创建网络研讨会的POST接口不需要传入['status'=>'active']作为查询参数,该参数仅用于查询已创建活动列表时做过滤,属于无效参数。

修正后的代码

$id = Yii::$app->request->get('id');

$bodyparam = [
   "topic"       => "test webinar",
   "type"        => 5,
   "start_time"  => "2021-10-02T16:00:00Z",
   "duration"    => 60,
   "timezone"    => "Asia/Singapore",
   "password"    => "test123456",
   "agenda"      => "Test Webinar",
   "recurrence"  => [
       "type"            => 1,
       "repeat_interval" => 1,
       "end_date_time"   => "2021-10-02T16:00:00Z"
   ],
   "settings" => [
       "host_video"       => true,
       "panelists_video"  => true,
       "practice_session" => true,
       "hd_video"         => true,
       "approval_type"    => 0,
       "registration_type"=> 2,
       "audio"            => "both",
       "auto_recording"   => "none",
       "enforce_login"    => false,
       "close_registration" => true,
       "show_share_button"  => true,
       "allow_multiple_devices" => false,
       "email_language"         => "en-US",
       "panelists_invitation_email_notification" => true,
       "registrants_confirmation_email"          => true,
       "registrants_email_notification"          => true,
       "attendees_and_panelists_reminder_email_notification" => [
           "enable" => true,
           "type"   => 1
       ],
       "follow_up_attendees_email_notification" => [
           "enable" => true,
           "type"   => 1
       ],
       "follow_up_absentees_email_notification" => [
           "enable" => true,
           "type"   => 1
       ]
    ]
 ];

// 直接传入数组格式的请求体,查询参数留空即可
$response = Yii::$app->zoom->doRequest('POST','/users/'.$id.'/webinars', [], $bodyparam);
echo "<pre>";print_r($response);exit;

额外检查项

请确认你的Zoom账号已开通网络研讨会(Webinar)权限,普通免费账号、基础付费账号默认没有创建Webinar的权限,需要单独升级对应套餐。

内容的提问来源于stack exchange,提问作者chiper4

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.30 22:48:02