Code=300; message=Api key and secret are required - Powershell

Hi Zoom community!
So recently I’m writing scripts running from our windows server, and one of our scripts purpose is to delete ex-employees accounts. When I get to the point where I’m trying to connect our Zoom Admin console using Rest API, I keep getting the same error:
error

@{code=300; message=Api key and secret are required.}

And I’m 100% sure that my creds are written correctly without any mistakes because it works properly while using the same credentials on Bash.
In addition, I have tried all encoding methods (UTF8 , ASCII, Default…), I don’t think it is something related to the encoding method…
Here are the parameters I tested the connection with:
#==========================
$clientid = “xxx”
$key = “xxx”
$url = “https://api.zoom.us/v1/metrics/zoomrooms
EncodedUsernamePassword = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes((’{0}:{1}’ -f $clientid, $key)))
Headers = @{'Authorization' = "Basic ($EncodedUsernamePassword)"; ‘accept’ = ‘application/json’; ‘Content-type’ = ‘application/json’; ‘Accept-Encoding’ = ‘gzip, deflate’}

Invoke-RestMethod -Method Get -Uri $url -Headers $Headers
#==========================

Assist is very needed here!
Thanks ahead! :slight_smile:

Hi @ora,

We are no longer supporting our V1 Apis. Please use our V2 APIs.

You can consider using the Delete user api to perform the operation.

Thanks!

Edit:
I managed to work this out! Apparently the token I have generated was expired or something…thanks for your help, now I have another little question :slight_smile:
I’m able to list users from a specific page, is there a way to list all our Zoom users? (and not by counting and using Foreach to display each page content)
Thanks again!

Hi @ora,

Please use the List Users API .

Thanks

I managed to fix this issue,
I had to use Bearer authentication instead of basic, and replace the api key&secret with the JWT token.
Thanks everyone :slight_smile:

2 Likes