Updating custom_attributes values for users

We would like to store another account identifier in addition to email address to help in account lifecycle management.

I was looking at using “custom_attributes” in the API for updating a user record:
[https://marketplace.zoom.us/docs/api-reference/zoom-api/users/userupdate]

I am able to update built-in fields like “job_title”:

zoom_user_base="https://api.zoom.us/v2/users/"
my_email="top@sec.ret"
R=requests.get(zoom_user_base+my_email,headers=zoom_dev.headers)
print(json.loads(R.content.decode()).get("job_title"))
R=requests.patch(zoom_user_base+my_email,headers=zoom_dev.headers,data='{"job_title":"Super Peon"}')
R=requests.get(zoom_user_base+my_email,headers=zoom_dev.headers)
print(json.loads(R.content.decode()).get("job_title"))

With output

Peon
Super Peon

However, when I try to add a custom_attribute, I get a 204 status code but the changes are not reflected in the user…When I try to supply JSON including custom attributes, like:

R=requests.patch(zoom_user_base+my_email,headers=zoom_dev.headers,data='{"job_title":"SysAdmin","custom_attributes":[{"key":"uid","name":"uid","value":"my_uid"}]}')
print(R.status_code)
R=requests.get(zoom_user_base+my_email,headers=zoom_dev.headers)
print(json.loads(R.content.decode()).get("job_title"))
print(json.loads(R.content.decode()).keys())

I get:

204
SysAdmin
dict_keys(['id', 'first_name', 'last_name', 'email', 'type', 'role_name', 'pmi', 'use_pmi', 'personal_meeting_url', 'timezone', 'verified', 'dept', 'created_at', 'last_login_time', 'pic_url', 'host_key', 'jid', 'group_ids', 'im_group_ids', 'account_id', 'language', 'phone_country', 'phone_number', 'status', 'job_title', 'location'])

No “custom_attributes” key is found, but the API call did update the job_title and gave no errors or warnings.

Anyone have luck with using custom_attributes?

Hey @ian.altgilbers,

Can you try sending without the array and just the object?

"custom_attributes":{"key":"uid","name":"uid","value":"my_uid"}

Let me know if that works.

Thanks,
Tommy

R=requests.patch("https://api.zoom.us/v2/users/"+my_email,headers=zoom_dev.headers,data='{"job_title":"SysAdmin","custom_attributes":{"key":"uid","name":"uid","value":"my_uid"}}')

That gives me a 400 response with content:

{"code":300,"message":"Request Body should be a valid JSON object."}

Hey @ian.altgilbers,

I figured it out. You have to add the custom attribute first here which sets the name value: https://zoom.us/account/user#/advanced

Then you can update the attribute:

{
  "custom_attributes":[{
    "key":"cbf_8y1njyfmtsk1hnbazp2ucw","name":"test","value":"set from API"
  }]
}

Thanks,
Tommy

Thank you Tommy.

Once I had the custom attribute defined, I was able to push values in.

1 Like

You are welcome! :slight_smile:

Thanks,
Tommy