Search code examples
phpphp-curlzoom-sdk

Zoom API request to create meeting


Im sending a cURL request to ZOOM's EU api to create a meeting. My requests do not draw any response from the API at all, even errors or refusals. What am I missing?

I have created a JWT App on Zoom's marketplace, from which I have gotten an API Key and an API Secret. I am using a function from ZoomAPIWrapper to generate the auth token:

private function generate_JWT()
{
    $token = [
        'iss' => $this->api_key,
        'exp' => time() + 60,
    ];
    $header = [
        'typ' => 'JWT',
        'alg' => 'HS256',
    ];

    $to_sign = self::url_safe_B64_encode(json_encode($header)) . '.' . self::url_safe_B64_encode(json_encode($token));
    $signature = hash_hmac('SHA256', $to_sign, $this->api_secret, true);
    return $to_sign . '.' . self::url_safe_B64_encode($signature);
}

URL is https://eu01api-www4local.zoom.us/users/me/meetings

Headers are:

Array
(
    [0] => Authorization: Bearer XXXXXAUTH_KEY_HEREXXXXX
    [1] => Content-Type: application/json
    [2] => Accept: application/json
)

And my request body is a JSON:

{
  "topic": "My workshop",
  "type": 2,
  "start_time": "2021-01-06T09:15:00Z",
  "duration": 375,
  "schedule for": "person@example.com",
  "timezone": "GMT",
  "agenda": "My workshop agenda",
  "settings": {
      "host_video": false,
      "participant_video": false,
      "mute_upon_entry": true,
      "approval_type": 0,
      "alternative_hosts": "",
      "close_registration": true,
      "waiting_room": true,
      "registrants_email_notification": true,
      "contact_name": "Official name",
      "contact_email": "official.email@example.com",
      "show_share_button": false,
      "allow_multiple_devices": true,
      "encryption_type": "enhanced_encryption"
  }
}

I submit all of the above:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

$result = curl_exec($ch);

Solution

  • Zoom docs state that:

    To support GDPR requirements of EU customers, you may use 
    https://eu01api-www4local.zoom.us 
    as the base URL for all API requests associated with EU accounts.
    

    except you also have to add /v2/ to the end of that url for it to work.

    I feel silly for not copping it sooner, but I also feel if you are posting a specific URL to use for specific users, you should post the whole thing...