Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!
SOLVED

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

Avatar

Level 3

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.");

1 Accepted Solution

Avatar

Correct answer by
Level 10

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

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

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