Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Cannot update primaryContactInfo

    Posted 17 days ago

    Hey everyone,

    I am trying to update a few hundred users' extension information.  While they have a primary DID in the WORK field, they have extensions defined in the WORK2 field.  I need to set the WORK2 (extension) as the primary for voice, however the primary PHONE is set to the DID, not the extension.  Below is what I am sending to the /api/v2/users/{userid} API.  Any suggestions would be greatly appreciated!

    "primaryContactInfo": [
                    {
                        "mediaType": "PHONE",
                        "type": "PRIMARY",
                        "extension": f"{extension}"
                    }
                ],
                "addresses": [
                    {
                        "address" : f"{phone}",
                        "display": f"{e164}",
                        "mediaType": "PHONE",
                        "type": "WORK",
                        "extension": "",
                        "countryCode": "US",
                        "integration": "directrouting"
                    },
                    {
                        "address": "",
                        "display": f"{extension}",
                        "mediaType": "PHONE",
                        "type": "WORK2",
                        "extension": f"{extension}",
                        "countryCode": "US"
                    }
                ]
            })

    #PlatformAPI

    ------------------------------
    Chad Meyer
    Global Voice Engineer
    ------------------------------


  • 2.  RE: Cannot update primaryContactInfo

    Posted 17 days ago

    Hey Chad,

    I haven't tried it myself, but wanted to give some pointers. Below are 2 threads talking about similar issues:

    Maybe one of them helps you in some way.

    Aside from that, I took a look at the schema for the Patch User API and I don't see the "primaryContactInfo" array in there, so I believe this isn't something that you can update through this API.. I might be wrong, but take a look at the schema below:

    ------------

    Also, if you look at the schema for the 200 Response for the "Get User" API, you can see that array in there, but it says it is populated from the "Addresses" array:

    So my guess is that you can't change that array directly, the information just comes from the "addresses" array.

    I'm not sure how you can update the primary contact number. Maybe just try changing the "WORK2" type from the extension to "PRIMARY" instead. But not sure if that messes anything else for you.



    ------------------------------
    Marcello Jabur
    ------------------------------



  • 3.  RE: Cannot update primaryContactInfo

    Posted 2 days ago

    Thanks for the clarification Marcello.  In my testing is seems that specifying "type": "PRIMARY" doesn't work as expected and will only assign the WORK entry as PRIMARY, no other fields.  Looking at the console logs when changing the primary radio button there is a GET and PUT request being sent to the following URL:

    https://api.usw2.pure.cloud/api/v2/users/{userid}/profile

    Here is full process to updating the primary contact address from 'Work Phone' to 'Work Phone 2'

    1 - GET Call to user profile

    https://{BASE_URL}/api/v2/users/{userid}/profile?expand=<string>&expand=routingStatus%2CprimaryPresence%2CconversationSummary%2CoutOfOffice%2Cgeolocation%2Cpresence%2Clocations%2Cauthorization&fl=*

    2 - Get the "_id" value from "phone_work_2"

    "phone_work_2": [
                {
                    "labelKey": "phone_work_2",
                    "rel": {
                        "e164": "4420999",
                        "phone_id": "16d038b0-2f08-4aad-afa4-bb0060cad3e0",
                        "extension_id": "9830429a-0c2d-4910-9dbf-f59c0045ad38"
                    },
                    "value": {
                        "number": "",
                        "extension": "4420999",
                        "acceptsSMS": false,
                        "countryCode": "US"
                    },
                    "_id": "6e22ETLmkWEWzKQDht0zMt"

    3 - PUT Call to https://{BASE_URL}/api/v2/users/{user_id}/profile

    JSON BODY - Paste the value of "_id" from Step 2 into "fieldID" value

    {
        "primaryContactInfo": {
            "voice": [
                {
                    "value": {
                        "fieldId": "6e22ETLmkWEWzKQDht0zMt",
                        "fieldPath": "contactInfo.phone_work_2"
                    }
                }
            ]
        }
    }

     

    The /api/v2/{user_id}/profile is currently listed as deprecated with the guide stating to use /api/v2/users.  Not sure if Genesys is planning on moving this in the future but if they are monitoring and could advise that would be appreciated.  Hope this helps. 



    ------------------------------
    Chad Meyer
    Global Voice Engineer
    ------------------------------