Zoom API 请求创建会议
Zoom API request to create meeting
我正在向 ZOOM 的 EU api 发送 cURL 请求以创建会议。我的请求根本没有得到 API 的任何回应,甚至是错误或拒绝。我错过了什么?
我在 Zoom 的市场上创建了一个 JWT 应用程序,我从中获得了一个 API 密钥和一个 API 秘密。我正在使用 ZoomAPIWrapper 中的函数来生成身份验证令牌:
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 是 https://eu01api-www4local.zoom.us/users/me/meetings
Headers 是:
Array
(
[0] => Authorization: Bearer XXXXXAUTH_KEY_HEREXXXXX
[1] => Content-Type: application/json
[2] => Accept: application/json
)
我的请求 body 是 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"
}
}
我提交以上所有内容:
$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);
Zoom 文档指出:
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.
除非您还必须将 /v2/
添加到 url 的末尾才能正常工作。
我觉得没有早点解决这个问题很愚蠢,但我也觉得如果你要 post 将特定的 URL 用于特定的用户,你应该 post 整个事情...
我正在向 ZOOM 的 EU api 发送 cURL 请求以创建会议。我的请求根本没有得到 API 的任何回应,甚至是错误或拒绝。我错过了什么?
我在 Zoom 的市场上创建了一个 JWT 应用程序,我从中获得了一个 API 密钥和一个 API 秘密。我正在使用 ZoomAPIWrapper 中的函数来生成身份验证令牌:
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 是 https://eu01api-www4local.zoom.us/users/me/meetings
Headers 是:
Array
(
[0] => Authorization: Bearer XXXXXAUTH_KEY_HEREXXXXX
[1] => Content-Type: application/json
[2] => Accept: application/json
)
我的请求 body 是 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"
}
}
我提交以上所有内容:
$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);
Zoom 文档指出:
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.
除非您还必须将 /v2/
添加到 url 的末尾才能正常工作。
我觉得没有早点解决这个问题很愚蠢,但我也觉得如果你要 post 将特定的 URL 用于特定的用户,你应该 post 整个事情...