Read in a zip file from API(url) in java

daver37819942

07-03-2018

Looking for example to read in a zip file from api call(specific url) using java in adobe campaign.

Retrieve a zip file then decompress

started by

/* URL */

  var url = "https://MY-URL";   

    var http = new HttpClientRequest(url);

    http.header["Connection"] = "Keep-Alive";   

    http.header["Content-Type"] = "application/x-www-form-urlencoded";

    http.header["Authorization"] = "Basic" + getOption("MYAUTH")

    http.method = "GET";

    http.execute();

    http.disconnect();

logInfo("Processing complete.");

Accepted Solutions (1)

Accepted Solutions (1)

Jean-Serge_Biro

MVP

08-03-2018

Hi Daver,

You may use either the ZipFile class (see JSAPI.chm documentation, under license).
You must get the URI and save it as a file.zip (for instance in a temporary folder), then you use the ZipFile class on that file.

Or, most of all if the compressed file is made with specific compression algorithms or options, I recommend using 7-ZIP free tool on your server (if possible for you to get such tool allowed, depending on the hosting On Cloud/On Premise).
In that case, it must be allowed in serverConf.xml if your Adobe Campaign instance has a recent build version.
You can either use an execCommand method (JSAPI again) or in a workflow, the External task activity to uncompress the file. 

Regards.
J-Serge

Answers (0)