codanji
(Najib)
August 30, 2023, 2:05am
1
Hey everyone,
I have a Zoom One Pro account and connecting a wordpress website to programatically retrieve all meetings for a user. The access token is being retrieved correctly using Server to Server Ouath2.0 setup which I created using Zoom developer. When i use the access token the following way however, when I check my error_logs im getting the following:
Errors:
[30-Aug-2023 01:46:09 UTC] Zoom HTTP Response Code:400
[30-Aug-2023 01:46:09 UTC] Zoom Get All Meetings Response:{“code”:200,“message”:“Account does not enabled REST API.”}
Here is how I’m calling the API:
function get_all_zoom_meetings() {
$token = get_zoom_access_token();
if(!$token) {
return false;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.zoom.us/v2/users/me/meetings');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
$headers = array();
$headers[] = 'Authorization: Bearer ' . $token;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
// Logging the HTTP Response Code
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
error_log('Zoom HTTP Response Code:' . $http_code);
if (curl_errno($ch)) {
error_log('Zoom Get All Meetings Error:' . curl_error($ch));
} else {
error_log('Zoom Get All Meetings Response:' . $result);
}
curl_close($ch);
return json_decode($result, true);
}
add_shortcode('zoom_test', 'zoom_test_function');
Now when I setup the same thing in postman im getting the status code of 200 and everything is working fine, so Im not sure why this error is occurring. In postman im able to create and retrieve meetings using the same credentials and account_id.
Please let me know how to solve this!
Hey @codanji , welcome and thanks for posting! Sorry about the blockage here!
Because requests work in Postman, I’d imagine this has to be an issue with the format of the HTTPS request being sent to the Zoom API.
The same access token works in Postman, but does not using this function? If you use this app to get a token, do your curl requests work? GitHub - zoom/server-to-server-oauth-token: Utility script to generate a Zoom Server-to-Server Oauth Token and copy to clipboard
ecodes
(ECODES)
September 20, 2023, 4:19pm
3
Sorry, i have the same problem.
I created a Server-To-Server OAuth App and i get the AccessToken without problems, but when i try to use the API iget the {“code”:200,“message”:“Account does not enabled REST API.”}
I get the same error on Postman.
I have ok the scopes on the app…
I really dónt know what else i can do
thanks
PD: i just created another Server-To-Server OAuth App and i get the same error.
system
(system)
Closed
September 21, 2023, 8:28pm
4
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
gianni.zoom
(OOO 11/1 - 11/8)
September 21, 2023, 8:30pm
5
Hi @ecodes , were you able to try the sample app? If not, please refer to this post or our Postman workspace to get the token:
A request for account_credentials requires an account_id in the URL, and a ClientID/ClientSecret in the request itself: " To use account credentials to get an access token for your app, call the Zoom OAuth token API with the account_credentials grant_type , your account_id , and your client ID and client secret, base64 encoded (encode your client ID and client secret with a colon between them, e.g. client_id:client_secret )."
By the way, it’s far easier to create/compose these requests using…
https://www.postman.com/zoom-developer/workspace/zoom-public-workspace/folder/22097587-0021aa9e-17f5-478e-b106-dfb31b930153
ecodes
(ECODES)
September 22, 2023, 7:59am
8
Hello Gianni, finally i find a PHP code with Curl that works, i publish it on github to help another developers woth the same problem!
1 Like
gianni.zoom
(OOO 11/1 - 11/8)
September 25, 2023, 9:26pm
9
Thank you @ecodes for sharing PHP code sample for Server-to-Server OAuth access token generation and API calls!
Hello all,
I am facing the same issue previously it was working before but it is not working now and it is showing me this error
Array
(
[code] => 200
[message] => Account does not enabled REST API.
)
When I am creating a meet url my meeting array is
Array
(
[topic] => Booking Meeting
[agenda] => Booking Meeting
[settings] => Array
(
[host_video] =>
[participant_video] => 1
[join_before_host] => 1
[audio] => 1
[approval_type] => 2
[waiting_room] =>
)
[password] => J2zD7L
)
Can you please help me in this case
gianni.zoom
(OOO 11/1 - 11/8)
October 26, 2023, 2:18pm
11
Hi @bloommedico , there are a few threads on this. Can you please perform a search?
What app type are you using to generate an access token? Does it have the scopes needed for the endpoint?
Please note that when creating an access token for S2S OAuth app, account id is required, but not for OAuth 2.0 app type.
Refer to our postman public workspace for some more guidance: Postman