Legacy Dev Forum Posts

 View Only

Sign Up

Please Help with Removing extensions to None / Python SDK

  • 1.  Please Help with Removing extensions to None / Python SDK

    Posted 06-05-2025 19:22

    chadmaggard95 | 2022-06-09 12:26:15 UTC | #1

    I have already read this. https://developer.genesys.cloud/forum/t/please-help-with-updating-user-info-python-sdk/3716 But that doesn't seem to show what I am trying to do. I need a way to remove extension from a user via the SDK or the API. I can add a new value or update a value just fine.. but how do you remove a value?

    newaddress = PureCloudPlatformClientV2.Contact() newaddress.media_type = 'PHONE' newaddress.type = "WORK"

    newaddress.phone_work.extension = ""

    newaddress.address = None newaddress.extension = None update_user.addresses = [newaddress]

    the update command.

    try: apiresponse = apiinstance.patchuser(currentuser.id, update_user) except Exception as e: print(e)

    returns error 400.

    Also , when attempting the API. The requirements do not seem to match. The user's group's is an optional field but, GroupContact and Group have require fields. If the users are not in a group.. what am I supposed to put in GroupContact or in the Group section.

    /api/v2/users/{userId}

    groups( array:#/definitions/Group, optional ): The groups the user is a member of

    GroupContact address( string, required ): Phone number for this contact type extension( string, optional ): Extension is set if the number is e164 valid type( string, required ): Contact type of the address Valid Values: GROUPRING, GROUPPHONE mediaType( string, required ): Media type of the address Valid Values: PHONE

    Groupname( string, required ): The group name.

    description( string, optional ):

    type( string, required ): Type of group. Valid Values: official, social

    images( array:#/definitions/UserImage, optional ):


    John_Carnell | 2022-06-09 12:59:20 UTC | #2

    Hi Chandra,

    I need to do some more research on the second item you gave us. The type for the extension field is a string. Rather than setting the value to None have you tried setting the extension field to an empty string ("").

    Thanks, John Carnell, Manager Developer Engagement


    chadmaggard95 | 2022-06-09 13:14:28 UTC | #3

    chadmaggard95, post:1, topic:15079

    newaddress.phone_work.extension = ""

    Hi, Yes, I tried an empty string .. " " and "" I left my commented out example in the code for reference.

    newaddress.phone_work.extension = ""


    chadmaggard95 | 2022-06-09 13:15:41 UTC | #4

    Also tried

    newaddress.extension = "" and #newaddress.extension = " "


    John_Carnell | 2022-06-09 13:46:28 UTC | #5

    Hi Chad,

    Thanks for trying that. I am working with the Dev team to get the exact behavior specified.

    Thanks, John Carnell


    chadmaggard95 | 2022-06-24 19:17:05 UTC | #6

    Hi, I figured out how to do it via the SDK.. Blanking out the display value seems to un-assign the extension.

    newaddress = PureCloudPlatformClientV2.Contact() newaddress.mediatype = 'PHONE' newaddress.type = "WORK" newaddress.display = '' updateuser.addresses = [newaddress]

    apiresponse = apiinstance.patchuser(currentuser.id, update_user)


    system | 2022-07-10 17:01:25 UTC | #7

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


    This post was migrated from the old Developer Forum.

    ref: 15079