Description
Good morning developers.
We have a situation where the clients SSO integration is not removing zoom users, but that is not why I am here today. While this bigger issue gets sorted out we would like to delete the users via a script that iterates through a CSV file and deletes each user.
I have successfully created python scripts that do similar things, create users, meetings etc. The calls seem to go out with no problems. (No 401 returned)
I have verified that app is account-level
The âcoreâ of my Python code is below, full script available on request.
Python 3, with http.client and csv imported:
user = str(row[0])
payload = (user+"?action=delete")
headers = {
'authorization': "Bearer xxxxxxxxxxxxxxxxxxx",
'content-type': "application/json"
}
print(payload)
print("DELETE","/v2/users/",payload, headers)
conn.request("DELETE","/v2/users/",payload, headers)
res = conn.getresponse()
data = res.read()
print (res.status)
print ("Reason:",res.reason)
print ("Message:",res.msg)
#Below line is full response
#print("Response:"+data.decode("utf-8"))
Error (email changed to protect the innocent)
EDIT: To be very clear the error is the response 405 âMethod Not Allowedâ Iâve checked the app permissions and roles, all seem to be correct.
Note: the top line of the output is a âdebugâ print (see above) of the data before it is called by conn.request, so it is probably not what is actually being sent.
DELETE /v2/users/ testacct@test.com?action=delete {'authorization': 'Bearer xxxxxxxxxxxxxxx', 'content-type': 'application/json'}
405
Message: Date: Fri, 02 Oct 2020 14:27:43 GMT
Content-Type: text/html;charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: ZOOM
x-zm-trackingid: WEB_5619ed313a2e5723801ab914fd80eb96
X-Content-Type-Options: nosniff
Cache-Control: no-cache, no-store, must-revalidate, no-transform
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: zm_aid=""; Domain=.zoom.us; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly
Set-Cookie: zm_haid=""; Domain=.zoom.us; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly
Set-Cookie: cred=AB16AC0E66B306B6E8AC9959DE5B2507; Path=/; Secure; HttpOnly
Allow: GET, POST
Set-Cookie: _zm_ctaid=P9_e0d-HQnCYpAv2quVC5g.1601648863739.0dda62e02eeb20f66bd63bde9f069c9b; Domain=.zoom.us; Expires=Fri, 02-Oct-2020 16:27:43 GMT; Path=/; Secure; HttpOnly
Set-Cookie: _zm_chtaid=345; Domain=.zoom.us; Expires=Fri, 02-Oct-2020 16:27:43 GMT; Path=/; Secure; HttpOnly
Set-Cookie: _zm_csp_script_nonce=ECm78yNbRamjQXQ0XhOQ0g; Domain=.zoom.us; Path=/; Secure; HttpOnly
Set-Cookie: _zm_currency=USD; Domain=.zoom.us; Expires=Sat, 03-Oct-2020 14:27:43 GMT; Path=/; Secure
Set-Cookie: _zm_mtk_guid=04dd4157db274f339e066d5398097a5e; Domain=.zoom.us; Expires=Mon, 30-Sep-2030 14:27:43 GMT; Path=/; Secure
Content-Language: en-US
Which App Type (OAuth / Chatbot / JWT / Webhook)?
JWT
Tried OAuth, no difference)
Which Endpoint/s?
EDIT: api.zoom.us/v2/users/
EDIT: I modified the Qurey and added false for all fields
payload = (user+"?transfer_recording=false&transfer_webinar=false&transfer_meeting=false&transfer_email=false&action=delete")
Still get 405, method not allowed.
I know this code base works, I can create users and their meetings, so it is very strange that a simple delete will not work.
My customer really needs to free up these accounts (members no longer with the organization) so that new students can be brought on board.
Any suggestions will be appreciated.