01-23-2023 11:39 AM - edited 01-23-2023 11:55 AM
I am trying to add a CUCM end user to an access control group. First I was trying update userUser to do this.
resp = destination_axl.updateUser(
**{ 'userid': userid,
'homeCluster': 'true',
'imAndPresenceEnable': 'true',
'primaryExtension': { 'pattern': primary_line['pattern'], 'routePartitionName': primary_line['routePartitionName'], },
'lineAppearanceAssociationForPresences': {
lineAppearanceAssociationForPresence: [
{
'laapAssociate': 't',
'laapProductType': dphone['return']['phone']['product'],
'laapDeviceName': dphone['return']['phone']['name'],
'laapDirectory': primary_line['pattern'],
'laapPartition': primary_line['routePartitionName'],
'laapDescription': dphone['return']['phone']['description'],
}
]
},
'associatedGroups': {
'userGroup': [
{
'name': 'Standard CTI Enabled',
'userRoles': { 'userRole': [ 'Standard CTI Enabled' ] }
},
{
'name': 'Standard CCM End Users',
'userRoles': { 'userRole': [ 'Standard CCM End Users', 'Standard CCMUSER Administration' ] }
}
]
},
}
)
Everything updated except for the group. Then I was thinking I needed to use addMembers in updateUserGroup, but I am failing to find the right syntax. I am looking at the AXL Schema Reference, but it isn't clicking. I tried to google some examples as well, but I am striking out there too.
Solved! Go to Solution.
01-23-2023 12:24 PM
Not sure I can spot any difference from your code, but I did update this sample to show updating associatedGroups: https://github.com/CiscoDevNet/axl-python-zeep-samples/blob/master/axl_add_update_User.py
groups = {
'userGroup': [
{
'name': 'Standard CTI Enabled',
'userRoles': {
'userRole': [
'Standard CTI Enabled'
]
}
},
{
'name': 'Standard CCM End Users',
'userRoles': {
'userRole': [
'Standard CCM End Users', 'Standard CCMUSER Administration'
]
}
}
]
}
# Execute the updateUser request
try:
resp = service.updateUser(
userid='testEndUser',
associatedDevices = devices,
associatedGroups = groups,
homeCluster=True,
imAndPresenceEnable=True
)
01-23-2023 11:57 AM
This is an example of how you do it with XML. I assume you just have to reinterpret this into JSON.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/14.0">
<soapenv:Header/>
<soapenv:Body>
<ns:updateUserGroup>
<name>Standard CTI Enabled</name>
<addMembers>
<member>
<userId>nicholas</userId>
</member>
</addMembers>
</ns:updateUserGroup>
</soapenv:Body>
</soapenv:Envelope>
01-23-2023 12:24 PM
Not sure I can spot any difference from your code, but I did update this sample to show updating associatedGroups: https://github.com/CiscoDevNet/axl-python-zeep-samples/blob/master/axl_add_update_User.py
groups = {
'userGroup': [
{
'name': 'Standard CTI Enabled',
'userRoles': {
'userRole': [
'Standard CTI Enabled'
]
}
},
{
'name': 'Standard CCM End Users',
'userRoles': {
'userRole': [
'Standard CCM End Users', 'Standard CCMUSER Administration'
]
}
}
]
}
# Execute the updateUser request
try:
resp = service.updateUser(
userid='testEndUser',
associatedDevices = devices,
associatedGroups = groups,
homeCluster=True,
imAndPresenceEnable=True
)
01-23-2023 01:30 PM
Thanks (again). I must be missing something in the syntax because I can't see the difference in the groups between your code and mine, but your works and mine doesn't. Urgh!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide