cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
524
Views
5
Helpful
2
Replies
Highlighted
Participant

updateUser Function Failed Using Python - CUCM AXL

Hi Guys,

I want to activate the home cluster and associate end device on the end user menu. I managed to get it working using Postman. Below are the code.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/11.5">
<soapenv:Header/>
<soapenv:Body>
<ns:updateUser>
<userid>TST User100</userid>
<associatedDevices>
<device>CSFTESTADD</device>
</associatedDevices>
<homeCluster>true</homeCluster>
<imAndPresenceEnable>true</imAndPresenceEnable>
</ns:updateUser>
</soapenv:Body>
</soapenv:Envelope>

But when I tried to 'translate' it to Python using the code below, it got "TypeError: Choice elements only work with keyword arguments" error notification.

try:
    resp = service.updateUser({'userid''GTS TST User100''associatedDevices': {'device''CSFTESTADD'}, 'homeCluster''true''imAndPresenceEnable''true'})
    print(resp)
except Fault:
    show_history()
Do I need to add something else on the Python code? Thank you
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Cisco Employee

The data for the updateUser() method is not a single object, but consists of multiple values/objects passed in as individual parameters (in the case where you have the option of using one key or another - such as 'userid' vs. 'uuid' - you must use the actual key name:)

# Create an associated devices object
devices = {
        'device': []
    }
devices['device'].append( 'CSFTESTPHONE' )

# Execute the updateUser request
try:
	resp = service.updateUser(
        userid = 'testEndUser',
        associatedDevices = devices,
        homeCluster = True,
        imAndPresenceEnable = True
        )

See the sample available here: https://github.com/CiscoDevNet/axl-python-zeep-samples/blob/master/axl_add_update_User.py

View solution in original post

2 REPLIES 2
Highlighted
Cisco Employee

The data for the updateUser() method is not a single object, but consists of multiple values/objects passed in as individual parameters (in the case where you have the option of using one key or another - such as 'userid' vs. 'uuid' - you must use the actual key name:)

# Create an associated devices object
devices = {
        'device': []
    }
devices['device'].append( 'CSFTESTPHONE' )

# Execute the updateUser request
try:
	resp = service.updateUser(
        userid = 'testEndUser',
        associatedDevices = devices,
        homeCluster = True,
        imAndPresenceEnable = True
        )

See the sample available here: https://github.com/CiscoDevNet/axl-python-zeep-samples/blob/master/axl_add_update_User.py

View solution in original post

Highlighted

Hi dstaudt,

That works like a charm. I did not realize the device had to be processed separately. Thank you for the help.

This widget could not be displayed.