Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Community Member

Reading a file in the documents folder using Rest API

 

 

We need to read a document in the UCCX documents folder using the REST API and are told that we can only read the contents of a file from the temp folder and we cannot read the contents of a file from the documents folder directly. This is causing an issue for us as the file in the temp folder does not have the most up to date information but the file in the documents folder has the up to date information, we either need to read the contents of the file in the documents folder or we need some way to update the file in the temp folder with the latest information any time a change is made to the file in the documents folder, the first method is highly preferred.

 

 

XML refresh – temp folder doesn’t have the updated numbers unless the file is first viewed

  • We are trying to download the contents of a document within UCCX and we were notified by Cisco TAC to use the following URL below. However this doesn’t have the latest updated information. It seems to update the /appdmin/temp/ file, one would have to manually view the Document file first so that it updates the temp folder.
  • How do we have the temp folder update with the latest information? We are pulling the document down from the Temp folder as we don't have any way to pull it from the documents folder currently (only pulls file info such as size and date, not contents) and we need the latest data contained in the Documents folder.
  • https://192.x.x.x/appadmin/temp/ENC-AgentInfo-Current.xml

 

 

Any help would be greatly appreciated.

Everyone's tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions

Thank you Greg:Use this URL:

Thank you Greg:

Use this URL: http://<uccx srv>:9080/documents/ENC-AgentInfo-Current.xml

if the xml file is in a folder /documents/foldername/filename

10 REPLIES

Ok, so the API is limiting

Ok, so the API is limiting you right now.  I see two alternative options:

1. In your AEF script where you are updating the Document in the repository, add additional steps to also update the Temp Document as well, this way the Temp is up to date when you pull it via the method given to you by TAC.

You would accomplish this with the new Make REST Call step.

2.  If you have Premium, create an HTTP Application and AEF Script which takes in a parameter of the Document you want the contents of, and then serve the contents of that file up as the HTTP response.

You would then call that HTTP Triggered Application like this:

http://uccxip:9080/triggername?file=testfile.xml

Here's a mock-up of a script that does just this.  Tweak it to work in your environment and/or with multiple language folders and paths.

Start
/* Read the file parameter */
requested_file = Get Http Contact Info (--Triggering Contact--, "file")
/* Convert to Document */
Set response_document = DOC[requested_file]
/* Send Document as response */
Send Http Response (--Triggering Contact--, response_document)
End
Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
Community Member

I have an XML document that

I have an XML document that we are updating through a script when a call comes through. I also have a CRM that is referencing that same document, but from the temp location (https://<IP address>/appadmin/temp/<file_name>) instead of from the actual Document folder (en_US). I am trying to update both the temp file and the document file in the same script, but I can’t seem to figure out how to utilize the “Make REST Call” step in order to accomplish the temp file upload.

 

 

Should I be using the Make REST Call step? How do I update the XML file in the /appadmin/temp folder?

Community Member

One of 2 solutions will get

One of 2 solutions will get us to the finish line and we are having a tough time with getting either to work.

 

1. Allow us to read the document in the DOCUMENTS folder directly, how come we can read it in the temp folder but not in the documents folder? Unfortunately the temp folder is not up to date so reading it from there does not give us the data we need with the latest agent call info.

When reading it in the documents folder it gives the file properties (size, date modified, created by) but when reading it from the temp folder it actually gives the document contents. Same XML command, same structure, same document, just a different folder. I cannot understand the reasoning behind this specific feature.

 

2. When a document in the documents folder is updated, update the files in the temp folder with the latest information automatically or via a script. This way when we read the file in the temp folder from our external application, it has the most up to date information.

 

 

We just started running this in a small production environment and in order for the end user to see the latest information from the external application, an admin has to go into the UCCX GUI and open the XML file in the documents folder first which then updates the TEMP folder which the user is reading from.

I'm really replying to most

..

Community Member

We started testing option 1

We started testing option 1 in your suggestion since we don't have Premium to test option 2 with. We run into an issue with the Cisco Upload document script.

 

The step that we use to upload to the Documents folder within the script is the “Upload Document”

 

 

However, I don’t believe we can use this same step to upload to the temp folder because it is requiring a “Language” which forces our XML into the documents en_US folder, the temp folder does not have a langauge (en_US) in it's path. Is it possible to use the Make REST Call step to upload this same XML document into the temp folder location?

 

Temp folder file and location:

https://<ip-address>/appadmin/temp/AgentInfo-Current.xml

I'm not sure which piece you

I'm not sure which piece you're tackling here, but I did say to upload your document via the Make REST Call step.  My thought was that you would use this API call here:

 

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
Community Member

The problem we run into is

The problem we run into is that in order to upload to the documents folder we pass in the user name and password via the HTTP authorization  to this URL:

https://192.x.x.x/adminapi/document/agent_file.xml

 

to read from the documents folder there is not an API we can use so we use the GUI and read directly from the temp folder

https://192.x.x.x/appadmin/temp/agent_file.xml

 

The temp folder does not have the latest up to date information but the documents folder has the latest up to date information. The way the temp folder receives the latest data is if we manually open the document from the GUI in the documents folder. When we try to automate opening this document from the GUI we have to use a standard browser URL and when using this URL it gives a network authentication box for username and password (popup logon box) when we pass in the logon information through the script it presents the UCCX HTML logon page instead of opening the document.

 

For the rest of our XML scripts we pass in the logon information through the HTTP header but in this case we do not have that option since we are trying to read the file outside of the API so it can update the changes to the temp folder and we cannot get past the logon prompt.

 

 

Hopefully it makes sense, we can only read from the temp folder but in order to update the copy of the file in the temp folder we need to manually open it's counterpart file in the documents folder. Opening the file in the documents folder is requiring network authentication and we can't get past this point in our scripting.

 

I think I understand now. 

I think I understand now.  The source of confusion was my own.  I assumed that the Admin API function "Upload Files to a Temporary Folder for Document" was the same temp folder you were already accessing.  Perhaps not.  I have not tested this.  Can you test it?

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

Thank you Greg:Use this URL:

Thank you Greg:

Use this URL: http://<uccx srv>:9080/documents/ENC-AgentInfo-Current.xml

if the xml file is in a folder /documents/foldername/filename

Community Member

Initial reports are that the

Initial reports are that the proposed URL that includes port 9080 has finally worked!

 

Thank You.

1678
Views
10
Helpful
10
Replies
CreatePlease to create content