Deleting Webinar via restAPI - problem

Hi, I am using the following to delete a webinar:

 $curl = curl_init();
                $url = 'https://api.zoom.us/v2/webinars/'.$webinarinstance->zoomid;
                curl_setopt_array($curl, array(
                    CURLOPT_URL => $url,
                    CURLOPT_RETURNTRANSFER => true,
                    CURLOPT_ENCODING => "",
                    CURLOPT_MAXREDIRS => 10,
                    CURLOPT_TIMEOUT => 30,
                    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                    CURLOPT_CUSTOMREQUEST => "POST",
                    CURLOPT_HTTPHEADER => array(
                        "authorization: Bearer mytoken",
                        "content-type: application/json"
                    ),
                ));

                $response = curl_exec($curl);

THe variables I get dynamically and they are fine. I don’t get a zoom error but I get a huge response (not json) with a bunch of html, css, and js.

What am I doing wrong?

Hey @huetherb,

Simple mistake, the “POST” should be a “DELETE” request.

CURLOPT_CUSTOMREQUEST => "DELETE",

 $curl = curl_init();
                $url = 'https://api.zoom.us/v2/webinars/'.$webinarinstance->zoomid;
                curl_setopt_array($curl, array(
                    CURLOPT_URL => $url,
                    CURLOPT_RETURNTRANSFER => true,
                    CURLOPT_ENCODING => "",
                    CURLOPT_MAXREDIRS => 10,
                    CURLOPT_TIMEOUT => 30,
                    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                    CURLOPT_CUSTOMREQUEST => "DELETE",
                    CURLOPT_HTTPHEADER => array(
                        "authorization: Bearer mytoken",
                        "content-type: application/json"
                    ),
                ));

                $response = curl_exec($curl);

Thanks,
Tommy

Just realized that! thanks!

1 Like

Happy to help :slight_smile:

-Tommy