Legacy Dev Forum Posts

 View Only

Sign Up

User : Update Primary contact and delete a phone number

  • 1.  User : Update Primary contact and delete a phone number

    Posted 06-05-2025 18:06

    matt22 | 2021-04-20 11:53:19 UTC | #1

    Hi everyone,

    I'm trying to update from API primary contact information of Genesys Agent. I see the updateuser and patchuser method. but :

    • i can't make it works to change the phone number. the user return is updated, but not on Genesys Cloud.
    • I don't know how to manage to remove a primary phone number ?

    Have you some help to give, an example of the API usage ?

    Thank you Matt


    Jerome.Saint-Marc | 2021-04-21 09:32:20 UTC | #2

    Hello,

    I think your problem comes from the fact that you are sending a value in the "state" attribute/parameter. Checking in the API description for the "Update user" endpoint, I see the following description for "state": *The state of the user. This property can be used to restore a deleted user or transition between active and inactive. If specified, it is the only modifiable field. Valid values: active, inactive, deleted.*

    So sending a value for state (ex: active) seems to take precedence over the rest of the changes.

    I have tried at API level using the API Explorer in Developer Tools - but the same should apply to the .Net SDK. I first retrieved the user information with a GET /api/v2/users/{userId} GetUser method in the .Net SDK]. And use it as input for my [Patch User (PATCH /api/v2/users/{userId}), modifying the user information first before calling the API endpoint.

    In my case, as I was doing the test at REST API level, I just removed the state attribute from my body. But setting the state attribute to an empty string should work as well.

    Then, if I want to modify the number, I change the "address" and "display" values of the corresponding entries in the "primaryContactInfo" array attribute, and in the "addresses" array attribute. If I want to remove the number, I remove the corresponding entries in the "primaryContactInfo" array attribute, and in the "addresses" array attribute.

    And then make a call to the Update User API endpoint (PatchUser in the .Net SDK).

    Regards,


    system | 2021-05-22 09:32:21 UTC | #3

    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: 10680