Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| vendors:cisco:uc:ucce:finesse:layouts [2024/09/30 16:54] – removed - external edit (Unknown date) 127.0.0.1 | vendors:cisco:uc:ucce:finesse:layouts [2024/09/30 17:25] (current) – gerardorourke | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Finesse Team Layouts ===== | ||
| + | <file python UpdateTeamsLayout.py> | ||
| + | # Gerry O' | ||
| + | # 30 September 2024 | ||
| + | # Version 1.0 | ||
| + | |||
| + | ################################################################################################################################################# | ||
| + | # 1. Configure a template Finesse config against an individual team using Finesse Admin GUI and confirm all OK. # | ||
| + | # Document the Team ID which has been configured with this template (team ID is a column on the Finesse Admin teams page) # | ||
| + | # # | ||
| + | # 2. Download the template using the API - https://< | ||
| + | # example: https:// | ||
| + | # This will ensure that the xml file is in the correct format. | ||
| + | # Note - you can use a browser to do this. You will be prompted for the Finesse admin' | ||
| + | # and once the layout xml is displayed on the screen - just right click and select "Save As" # | ||
| + | # # | ||
| + | # 3. Upload the template to a webserver - in the below example I upload to the IIS Server where I also run the python script, | ||
| + | # hence I use http:// | ||
| + | # # | ||
| + | # 4. Configure the team_ids array and the layoutName Variable (the filename)- as per below example. | ||
| + | # NOTE - If layoutName is NOT set - the default layout is assumed! # | ||
| + | # # | ||
| + | # 5. Configure the Finesse URL, admin, password and the webserver url where the layoutName templates are located. # | ||
| + | # # | ||
| + | # The script will downloads the XML template file and uploads it to the relevant teams (with a delay of 0.5 seconds between each team). | ||
| + | # Repeat the steps for each Template and group of teams you need to update | ||
| + | ################################################################################################################################################# | ||
| + | |||
| + | import requests # used for http requests | ||
| + | from requests.auth import HTTPBasicAuth | ||
| + | import sys # used for sys.exit | ||
| + | import urllib3 # | ||
| + | import os #check / creating folders | ||
| + | urllib3.disable_warnings() #Surpress cert warnings | ||
| + | import xml.etree.ElementTree as ET | ||
| + | from time import sleep | ||
| + | |||
| + | # Set Finesse FQDN, username & password below | ||
| + | finesseHost = ' | ||
| + | finesseUsername = ' | ||
| + | finessePassword = ' | ||
| + | |||
| + | # Location where you place the layout templates you want to upload to Finesse. | ||
| + | template_base_url = ' | ||
| + | |||
| + | # Set team_ids & set ' | ||
| + | # i.e. comment out ' | ||
| + | |||
| + | #Team1 | ||
| + | #team_ids = [5075] | ||
| + | #layoutName = ' | ||
| + | |||
| + | #Team2 | ||
| + | #team_ids = [5333] | ||
| + | #layoutName = ' | ||
| + | |||
| + | #BothTeams (set as many team ids you need) | ||
| + | team_ids = [5075, | ||
| + | layoutName = ' | ||
| + | |||
| + | |||
| + | ################################################################################################################################################## | ||
| + | |||
| + | def get_layout(): | ||
| + | url = template_base_url + '/' | ||
| + | response = requests.get(url) | ||
| + | responseStatusCode = (response.status_code) | ||
| + | responseText = response.text | ||
| + | if (responseStatusCode == 200): | ||
| + | # | ||
| + | xml = responseText | ||
| + | | ||
| + | for id in team_ids: | ||
| + | layout_update(id, | ||
| + | sleep(500/ | ||
| + | else: | ||
| + | print(' | ||
| + | print(' | ||
| + | | ||
| + | def layout_update(id, | ||
| + | url = ' | ||
| + | basic = HTTPBasicAuth(finesseUsername, | ||
| + | response = requests.put(url, | ||
| + | responseStatusCode = (response.status_code) | ||
| + | responseText = response.text | ||
| + | if (responseStatusCode == 200): | ||
| + | print(' | ||
| + | else: | ||
| + | print (' | ||
| + | print(' | ||
| + | print (xml) | ||
| + | exit(1) | ||
| + | | ||
| + | def are_you_sure(): | ||
| + | confirm = input(' | ||
| + | if confirm == ' | ||
| + | print(" | ||
| + | else: | ||
| + | print(" | ||
| + | exit() | ||
| + | |||
| + | try: | ||
| + | team_ids | ||
| + | except NameError: | ||
| + | print("' | ||
| + | exit(1) | ||
| + | else: | ||
| + | print("' | ||
| + | |||
| + | try: | ||
| + | layoutName | ||
| + | except NameError: | ||
| + | print("' | ||
| + | are_you_sure() | ||
| + | print(' | ||
| + | xml = '< | ||
| + | for id in team_ids: | ||
| + | layout_update(id, | ||
| + | sleep(500/ | ||
| + | | ||
| + | else: | ||
| + | print("' | ||
| + | print(' | ||
| + | are_you_sure() | ||
| + | get_layout() | ||
| + | </ | ||