cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1853
Views
10
Helpful
3
Replies

Renaming files in UCCX with the REST API - sanity check so I don't wipe out my production files

detho9000
Level 1
Level 1

I'm looking to do a pretty simple operation of renaming prompt WAVs and then refreshing the associated script.

API guide that I'm using: https://developer.cisco.com/docs/contact-center-express/#!modify-file/sample-input-xml-modifying-a-script-file-name

 

Right now I'm just testing things out and I want to make sure I'm not going to accidentally wipe out all of my production prompts.  So I've created a folder named "ScriptDev" and put some test files in there and I want to run this PUT statement using Postman:

PUT  https://SERVERNAME/adminapi/prompt

JSON payload:

{
   "Script": {
      "File": {
         "path": "/en_US/ScriptDev/",
         "FileName": "1000.wav",
         "reNameTo": "1000rename.wav"
      }
   }
}

I want to be 100% certain that even though my URL is specifying the Resource Name of "prompt" I can ONLY affect prompts (or other files) in the folder path of "/en_US/ScriptDev/".  Can someone confirm this?

 

*******UPDATE*******

For anyone else who had this question here's an update with the final result.  To answer my own question; no the PUT statement will not wipe out the existing prompts if you do something wrong.  That's to say, none of things that I did wrong had any unintended effect on the existing prompts/scripts/configuration, etc.  I just got 4xx and 5xx errors when I did something wrong and no changes were made.  Of course YMMV.

 

Here's the final URL and JSON payload that worked (using my example from above):

URL:  https://<SERVERNAME>/adminapi/prompt/en_US/ScriptDev/1000.wav

{
   "Prompt": {  <------NOTE this specifies the type (prompt, script, grammar, document, etc) that you're modifying
      "File": {
         "path": "/en_US/ScriptDev/",
         "FileName": "1000.wav",
         "reNameTo": "1000rename.wav"
      }
   }
}

Note that I had to specify the file path and filename in the URL and the JSON Payload.

 

Also an interesting thing I found is that I could my Active Directory credentials in the Basic Authentication to retrieve information (ie "GET" statements) but my AD creds wouldn't work when making modifications (ie "PUT", "DELETE", etc).  I had to use the local administrator account for UCCX in the basic authentication to make changes.

3 Replies 3

Quigath
Spotlight
Spotlight

I wouldn't trust the API with my production files either :)

Are you trying to rename the files dynamically as part of a call or an agent operation?
If not, then I'd recommend to backup your production files by downloading them with an sftp application (like filezilla), to get them off the server. Then either run your commands using the API, or rename the files on your dev machine and upload the altered files.

Thanks for the reply.  I'm trying to automate an annoying task with a script :)  The server is automatically backed up every night with two days of retention, so I'm not worried about losing data, it's really more about downtime.  Also we have dozens of scripts we hundreds of prompts so right-clicking and saving each prompt isn't really feasible.

>we have dozens of scripts we hundreds of prompts so right-clicking and saving each prompt isn't really feasible

You can download all scripts with one click and the same prompts if they are in a folder.

you download the folder and it zips all the scripts / prompts into a single file.

 

See below where I left clicked on the folder icon and all prompts in en-US folder are downloaded into a single zip file.

 

Gerry

downloadPrompts.JPG