All of the user's contact info gets overwritten when trying to remove only their MOBILE number. Is there a way to leave the other contact fields untouched? Here is the contact info before, the code that was run, and the contact info fields after:
Before
"primaryContactInfo": [
{
"address": "Joe.Smith@acme.com",
"mediaType": "EMAIL",
"type": "PRIMARY"
},
{
"address": "+18005551212",
"mediaType": "SMS",
"type": "PRIMARY"
},
{
"address": "+18885551212",
"display": "+1 888-555-1212",
"mediaType": "PHONE",
"type": "PRIMARY"
}
],
"addresses": [
{
"address": "+18775551212",
"display": "+1 877-555-1212",
"mediaType": "SMS",
"type": "MOBILE",
"countryCode": "US"
},
{
"address": "+18665551212",
"display": "+1 866-555-1212",
"mediaType": "PHONE",
"type": "WORK",
"countryCode": "US"
}
]
After
"primaryContactInfo": [
{
"address": "Joe.Smith@acme.com",
"mediaType": "EMAIL",
"type": "PRIMARY"
}
],
"addresses": []
Code
api_instance = PureCloudPlatformClientV2.UsersApi(api_client)
print("\n*** Start of User Update ***")
updateuser = PureCloudPlatformClientV2.UpdateUser()
updateuser.version = "8"
contact = PureCloudPlatformClientV2.Contact()
contact.address = None
contact.display = ""
contact.media_type = "SMS"
contact.type = "MOBILE"
contact.country_code = ""
updateuser.addresses = [contact]
print("*** JSON body ***\n", api_client.sanitize_for_serialization(updateuser))
try:
api_response = api_instance.patch_user("XXXXXXXXXXXXXXXX",updateuser)
pprint(api_response)
except ApiException as e:
print("*** Exception when calling UsersApi -> patch_user: %s ***\n" % e)