cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1599
Views
5
Helpful
2
Replies

updateUser Function Failed Using Python - CUCM AXL

fdharmawan
Level 4
Level 4

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

dstaudt
Cisco Employee
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

dstaudt
Cisco Employee
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

Hi dstaudt,

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