Using API/JWT to change user, get a 204 success but change is not done

Description

I have a python script that should just allow managing a user.

from zoomus import ZoomClient
import config
client = ZoomClient(config.API_KEY, config.API_SECRET)
user_r = client.user.get( id = args.email )
user = json.loads(user_r.content)

I get proper answer.

Then I modify the user and send the modification

user['dept'] = "Test"
res = client.user.update(id = user['id'], data = user)

Error

I get a 204 answer with a null body.

but data of the user is not changed.

Which App Type (OAuth / Chatbot / JWT / Webhook)?

Using JWT

Which Endpoint/s?

PATCH /v2/users/

Other

using python zoomus package. Enabled the urlib3 debugging and every parameters looks ok.

Hey @marc.furrer,

Can you send us the link to the python zoomus package you are using?

Also do you have SSO turned on? You may not be allowed to edit the department.

Thanks,
Tommy

Hi @tommy
I am not using SSO, python package is zoomus, details below.
I you have another recommandation, I am happy to hear about it, nothing much developed yet :slight_smile:
Best regards,
Marc.

 pip show zoomus
Name: zoomus
Version: 1.1.1
Summary: Python client library for Zoom.us REST API v1 and v2
Home-page: https://github.com/actmd/zoomus
Author: Zoomus Contributors
Author-email: zoomus@googlegroups.com
License: Apache Software License
Location: /dev/zoom-scritps/venv/lib/python3.6/site-packages
Requires: requests, PyJWT

I have simplified my script, here is the debug form url lib:

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.zoom.us:443
send: b'PATCH /v2/users/xxxxxxxxxxxxxxxxxxxxxxx HTTP/1.1\r\nHost: api.zoom.us\r\nUser-Agent: python-requests/2.23.0\r\nA
ccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nAuthorization: Bearer x
vS3ak\r\nContent-Type: application/json\r\nContent-Length: 73\r\n\r\n'
send: b'{"id": "xxxxxxxxxxxxxxxxxxxxxxx", "data": {"dept": "MFU-Test", "type": 1}}'
reply: 'HTTP/1.1 204 \r\n'
DEBUG:urllib3.connectionpool:https://api.zoom.us:443 "PATCH /v2/users/xxxxxxxxxxxxxxxxxxxxxxx HTTP/1.1" 204 0

and log from the API is :

 {
endpoint: "https://api.zoom.us/v2/users/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
response_headers: [
"Set-Cookie: zm_aid=""; Domain=.zoom.us; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly"],

date_time: "2020-04-07 08:59:12",
method: "PATCH",
request_body: "{"id":"xxxxxxxxxxxxxxxxxxxxxxx ","data":{"dept":"MFU-Test","type":1}}",
response: "N/A",
request_headers: [
"accept-encoding: gzip, deflate",
"accept: */*",
"authorization: ******",
"connection: close",
"content-type: application/json",
"user-agent: python-requests/2.23.0"
],
request_params: [
],
http_status: "204"
} 

Hey @marc.furrer,

Thanks for sharing logs, I now see the issue. The request body is incorrect.

{"id":"xxxxxxxxxxxxxxxxxxxxxxx ","data":{"dept":"MFU-Test","type":1}}

It should be this:

{"dept":"MFU-Test","type":1}

Let me know if that fixes it.

-Tommy

your right, issue with the library. did a manual patch. works thanks. :+1:

1 Like

Happy to hear you got it working! :slight_smile:

-Tommy