Legacy Dev Forum Posts

 View Only

Sign Up

PureCloudPlatformClientV2.UpdateUser() patch_user addresses dynamically

  • 1.  PureCloudPlatformClientV2.UpdateUser() patch_user addresses dynamically

    Posted 06-05-2025 18:29

    Peter_Eskofier | 2024-01-12 11:07:58 UTC | #1

    Hi, how can I add dynamically the addresses of an user?

    I need to make a mass update of agents contact information. As some have "work", "work2" or "work" and "work2" and "mobile" I need to dynamically set the addresses[] for each user. I tried to use addresses.append() etc. but the list methods aren't available.

    So, how can I fill with a dynamic list the addresses?


    currentuser = authApi.getuser(userid)

    pprint(currentuser)

    print("\n##################################\n")

    updateuser = PureCloudPlatformClientV2.UpdateUser() updateuser.version = currentuser.version

    work = PureCloudPlatformClientV2.Contact() work.address = "+498930123456" work.media_type = "PHONE" work.type = "WORK"

    work2 = PureCloudPlatformClientV2.Contact() work2.address = "+49911123456" work2.media_type = "PHONE" work2.type = "WORK2"

    work3 = PureCloudPlatformClientV2.Contact() work3.extension = "489" work3.media_type = "PHONE" work3.type = "WORK3"

    mobile = PureCloudPlatformClientV2.Contact() mobile.address = "+4915251234567" mobile.media_type="SMS" mobile.type = "MOBILE"

    updateuser.addresses = [work, work2, work3, mobile]

    apiresponse = authApi.patchuser(user_id, updateuser)



    Peter_Eskofier | 2024-01-12 11:14:16 UTC | #2

    Ok, solved it just now.


    currentuser = authApi.getuser(userid)

    pprint(currentuser)

    print("\n##################################\n")

    contacts = []

    updateuser = PureCloudPlatformClientV2.UpdateUser() updateuser.version = currentuser.version

    work = PureCloudPlatformClientV2.Contact() work.address = "+498930123456" work.media_type = "PHONE" work.type = "WORK"

    contacts.append(work)

    work2 = PureCloudPlatformClientV2.Contact() work2.address = "+49911123456" work2.media_type = "PHONE" work2.type = "WORK2"

    contacts.append(work2)

    work3 = PureCloudPlatformClientV2.Contact() work3.extension = "489" work3.media_type = "PHONE" work3.type = "WORK3"

    contacts.append(work3)

    mobile = PureCloudPlatformClientV2.Contact() mobile.address = "+4915251234567" mobile.media_type="SMS" mobile.type = "MOBILE"

    contacts.append(mobile)

    updateuser.addresses = contacts

    apiresponse = authApi.patchuser(user_id, updateuser)



    system | 2024-02-11 11:14:38 UTC | #3

    This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 24091