01-21-2019 05:55 AM - edited 03-14-2019 06:44 PM
Just checking before I reinvent the wheel.
Has anyone written a script to backup and restore the user specific settings for UCCX via the API?
Running into a situation with a merged LDAP tree where some branches become unavailable at times. This causes the UCM users to go "Inactive". As long as the LDAP issue is resolved within the garbage collection window UCM is fine, but as soon as the users go "Inactive" on UCM, UCCX removes their skills/team/supervisor settings. I understand this is expected, but I'd rather not have to do a system restore every time that happens since the LDAP issues in this environment are outside of my control.
Thanks
01-21-2019 01:07 PM
01-21-2019 01:56 PM
I'm pretty sure no-one accessed the page in the intervening time between the LDAP outage and the restoration. I did have to run a manual LDAP sync on UCM, and then logged into UCCX to make sure SSO was working again.
Anyway, it seems like that data is too precious not to protect in an easily accessible manner if it is possible for this to happen in this environment. I'll probably just write my own, I just wanted to make sure someone didn't have one tucked away on GitHub before doing so.
Looks like I can just do a get resource list, and then do a get resource for each name in the list and store the JSON response in a text file. Then reverse the process with a modify resource loop if we need to restore.
01-22-2019 05:47 AM
The CCX provisioning API is RESTFUL using XML, so writing a quick tool with Python should be simple. I don't have code to share but using Requests and one of the standard XML libraries should take little time to write something. All necessary documentation can be found on the Cisco DevNet pages.
01-22-2019 11:37 AM - edited 01-22-2019 01:43 PM
What do you think would happen if you sent a REST API request to fix a user, who used to be a Supervisor, but after the deletion/re-sync, they lost their Supervisor role? I would think you would need to modify their role first, then send the request, but maybe I'm wrong, and the request would trigger an internal UCCX event to add that role to the user, to support the request? I don't know. I'll have to try it out.
EDIT
Just tried to do this and the API returned an error:
"errorData": "Trying to modify unmodifiable fields [type, secondrySupervisorOf]",
And from what I can tell, you cannot make someone a Supervisor with the API. Unless I'm just not seeing it. Do you know?
So if not, you'd just have to manually add the Supervisor role to all of the Supervisors quick, and then run your import script.
EDIT2:
Actually, even after updating the role of my user to be a Supervisor again, the export I took prior, cannot be imported, as I get the same error regardless.
I'm running 11.6(2)ES02. So, it looks like you will have to strip out all of the XML for Supervising Teams first, then submit just the Agent specific config (RG, Skills, Team and Alias). Followed by, having exported all of Teams, and re-importing the Teams to get this Supervisor back into the Team. I did this and it worked.
High Level Steps
I think that's right, unless we can figure out how to make it more streamlined.
EDIT3:
From where and how often would you run the exports?
01-22-2019 02:45 PM
01-22-2019 04:03 PM - edited 01-22-2019 04:04 PM
Or use something like the Python Requests module to create a browsing session to UCCX AppAdmin, and just submit the form yourself? I use Python Requests today, to login an pull data, but I haven't done it yet, to post data. Should be possible though.
EDIT:
Why stop at Resources and Teams? Might as well make COBRAS for UCCX, am I right? The ability to restore individual objects without restoring the entire server seems useful.
01-22-2019 07:05 PM
01-22-2019 07:21 PM
Unlike SOAP API which is what CUCM uses, CCX uses REST API which makes it 1000% easier to write anything to update/export as it deals with XML rather than crazy SOAP data structure and there is no need for Zeep or Jurko-Suds Python libraries. If you are proficient with Python or other language you can write something within minutes to export or update supported data. Perhaps one of these days Cisco will switch from XML to JSON and makes it even easier on us, one can hope :-)
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