I want to create a webinar event using zoom API, i create body data using php and format json in json_encode but when i send POST to zoom API it doesn't work. The result always like this:
[
[code] => 300
[message] => Request Body should be a valid JSON object.
]
this is my code in controller:
$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
]
]
];
//using json_decode and double encode because if i just encode once the result always string
$body = json_encode(json_decode(json_encode($bodyparam)), JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);
$response = Yii::$app->zoom->doRequest('POST','/users/'.$id.'/webinars',['status'=>'active'], $body);
echo "<pre>";print_r($response);exit;
I used skwirrel zoom api wrapper to help me create this event. Is there something wrong?