10-11-2022 08:22 AM
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?
10-13-2022 02:54 AM
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
10-13-2022 08:01 AM
Hi @dhiarumu thank you for the suggestion. I do not have JSZip in my project, is there a way to do this without JSZip?
10-13-2022 08:50 PM
Hi @matthew.bavosa,
There should be some alternatives for JSZip, we haven't tried others as JSZip solves the purpose.
Thanks
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