cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
438
Views
5
Helpful
3
Replies

How is the proper way to use the CompressedClientLog Finesse API?

matthew.bavosa
Level 1
Level 1

Hi All, How can I best format my POST request for CompressedClientLog? 

CompressedClientLog—Post Compressed Log to Finesse - Finesse - Document - Cisco DevNet

CompressedClientLog—Post Compressed Log to Finesse

 

var data = new FormData();
var logObj = '<ClientLog><logData>This is some logged data for the log file</logData></ClientLog>';
data.append("logData", logObj);

var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log("Gadget is now engaged" + this.responseText);
  }
});
xhr.open("POST", "https://finesse1.xyz.com/finesse/api/User/finadmin/CompressedClientLog");
xhr.send(data);
<ApiErrors>
  <ApiError>
    <ErrorType>Parameter Missing</ErrorType>
    <ErrorData>logData</ErrorData>
    <ErrorMessage>Missing logData in the ClientLog object</ErrorMessage>
  </ApiError>
</ApiErrors>

 

Where am I going wrong?

3 Replies 3

dhiarumu
Cisco Employee
Cisco Employee

Hi,

 

Please try this.

var data = new FormData();
var logObj = '<ClientLog><logData>This is some logged data for the log file</logData></ClientLog>';
data.append("logData", logObj);
var logZip = new JSZip();
logZip.file("abc.txt", window.finesse.modules.LocalStorageViewer.getContents(null, null));
                logZip.generateAsync({
                type: 'blob',
                compression: 'DEFLATE',
                compressionOptions: {
                    level: 9
                }
                }).then(function(file) {
                     var postdata = new FormData();
                    postdata.append("file", file);

                    var xhr = new XMLHttpRequest();
                    xhr.addEventListener("readystatechange", function() {
                      if(this.readyState === 4) {
                        console.log("sent" + this.responseText);
                      }
                    });
                    xhr.open("POST", "https://finessefqdn:8445/finesse/api/User/someuser/CompressedClientLog");
                    xhr.send(postdata);
                })

Thanks

Hi @dhiarumu  thank you for the suggestion. I do not have JSZip in my project, is there a way to do this without JSZip?

dhiarumu
Cisco Employee
Cisco Employee

Hi @matthew.bavosa

There should be some alternatives for JSZip, we haven't tried others as JSZip solves the purpose.

Thanks

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: