zoomus icon indicating copy to clipboard operation
zoomus copied to clipboard

Example for user.update() method

Open xezpeleta opened this issue 5 years ago • 2 comments
trafficstars

Hi!

First of all, thanks for your great project!

I'd like to update the user type (basic, licensed) based on the scheduled meetings. Do you have any working example for the client.user.update(...) method?

Thanks!

xezpeleta avatar Mar 27 '20 09:03 xezpeleta

Hi @xezpeleta, I unfortunately don't have an example for this explicitly, but under the hood all these methods do is GET, POST, PATCH, DELETE the objects based on Zoom's REST API.

When you do get it working, can you post your example here. I will start an examples directory in the near future and we can add all of those in there.

Thank you for using the library and I wish you all the best!

prschmid avatar Mar 27 '20 10:03 prschmid

When you do get it working, can you post your example here. I will start an examples directory in the near future and we can add all of those in there.

'''
The following code changes the user type, from non licensed to licensed
'''

USER_NON_LICENSED = 1
USER_LICENSED = 2

client = ZoomClient(API_KEY, API_SECRET)
users = json.loads(client.user.list().content)['users']
for user in users:
    if user['type'] == USER_NON_LICENSED:
        user_data = {
            "id": user['id'],
            "type": USER_LICENSED
        }
        response = client.user.update(**user_data)
        if response.status_code == 204:
            print("User %s is now licensed" % user['email'])
        else:
            print("ERROR: cannot change the user. More info: {}".format(response.text))

xezpeleta avatar Mar 31 '20 08:03 xezpeleta