I’m trying to create a new webinar in Zoom using a standard PL/SQL function calling the Zoom webinar API.The code runs but a webinar is not created and therefore I do not get a webinar id back.
Would greatly appreciate it, if you could spare a few minutes to take a look.
Below is the function -
create or replace FUNCTION get_new_webinar_id (
p_user_id VARCHAR2,
p_topic VARCHAR2 DEFAULT NULL,
p_type PLS_INTEGER DEFAULT NULL,
p_start_time TIMESTAMP WITH TIME ZONE DEFAULT NULL,
p_duration VARCHAR2 DEFAULT NULL,
p_timezone VARCHAR2 DEFAULT NULL,
p_pwd VARCHAR2 DEFAULT NULL,
p_agenda VARCHAR2 DEFAULT NULL,
p_recurrence_type PLS_INTEGER DEFAULT NULL,
p_repeat_interval PLS_INTEGER DEFAULT NULL,
p_end_date_time TIMESTAMP WITH TIME ZONE DEFAULT NULL,
p_hd_video BOOLEAN DEFAULT NULL,
p_panelists_video BOOLEAN DEFAULT NULL,
p_practice_session BOOLEAN DEFAULT NULL,
p_host_video BOOLEAN DEFAULT NULL,
p_approval_type PLS_INTEGER DEFAULT NULL,
p_registration_type PLS_INTEGER DEFAULT NULL,
p_audio VARCHAR2 DEFAULT NULL,
p_auto_recording VARCHAR2 DEFAULT NULL,
p_enforce_login BOOLEAN DEFAULT NULL,
p_enforce_login_domains VARCHAR2 DEFAULT NULL,
p_alternative_hosts VARCHAR2 DEFAULT NULL,
p_close_registration BOOLEAN DEFAULT NULL,
p_show_share_button BOOLEAN DEFAULT NULL,
p_allow_multiple_devices BOOLEAN DEFAULT NULL,
p_webinar_id PLS_INTEGER DEFAULT NULL
)
RETURN PLS_INTEGER
IS
l_webinar CLOB;
l_url VARCHAR2 (32767);
l_clob CLOB;
j apex_json.t_values;
l_webinar_id PLS_INTEGER;
l_http_method VARCHAR2 (10) := 'POST';
l_test VARCHAR2 (32767);
BEGIN
l_url :='https://api.zoom.us/v2/users/' || trim(p_user_id) || '/webinars';
dbms_output.put_line('initialize_clob_output');
apex_json.initialize_clob_output;
apex_json.open_object ();
apex_json.write ('topic', p_topic);
apex_json.write ('type', p_type);
apex_json.write ('start_time', p_start_time);
apex_json.write ('duration', p_duration);
apex_json.write ('timezone', p_timezone);
apex_json.write ('password', p_pwd);
apex_json.write ('agenda', p_agenda);
--IF p_recurrence_type IS NOT NULL
--THEN
apex_json.open_object ('recurrence');
apex_json.write ('type', p_type);
apex_json.write ('repeat_interval', p_repeat_interval);
apex_json.write ('end_date_time', p_end_date_time);
apex_json.close_object;
--END IF;
apex_json.open_object ('settings');
apex_json.write ('host_video', p_host_video);
apex_json.write ('panelists_video', p_panelists_video);
apex_json.write ('practice_session', p_practice_session);
apex_json.write ('hd_video', p_hd_video);
apex_json.write ('approval_type', p_approval_type);
apex_json.write ('registration_type', p_registration_type);
apex_json.write ('audio', p_audio);
apex_json.write ('auto_recording', p_auto_recording);
apex_json.write ('enforce_login', p_enforce_login);
apex_json.write ('enforce_login_domains', p_enforce_login_domains);
apex_json.write ('alternative_hosts', p_alternative_hosts);
apex_json.write ('close_registration', p_close_registration);
apex_json.write ('show_share_button', p_show_share_button);
apex_json.write ('allow_multiplace_devices', p_allow_multiple_devices);
apex_json.close_object ();
l_webinar := apex_json.get_clob_output ();
l_webinar := REPLACE (l_webinar, '\/', '/');
--dbms_output.put_line(l_webinar);
set_request_headers;
dbms_output.put_line ('l_url ' || l_url);
dbms_output.put_line ('set l_clob');
l_clob :=
apex_web_service.make_rest_request(
p_http_method => l_http_method,
p_url => l_url,
p_body => l_webinar,
p_wallet_path => 'file:/u01/app/admin/htmlprd/WALLETS',
p_wallet_pwd => NULL,
p_proxy_override => 'pdit-b2b-proxy.oraclecorp.com');
apex_json.parse (j, l_clob);
l_webinar_id := apex_json.get_number (p_path => 'id', p_values => j);
dbms_output.put_line ('l_webinar_id is ' || l_webinar_id);
IF l_webinar_id IS NULL AND p_webinar_id IS NULL
THEN
dbms_output.put_line ('inside first if statement');
RETURN NULL;
END IF;
dbms_output.put_line ('outside first if statement');
RETURN CASE
WHEN p_webinar_id IS NOT NULL THEN p_webinar_id
ELSE l_webinar_id
END;
END get_new_webinar_id;
Thanks in advance.
Best Regards,