Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

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

daver37819942
Level 3
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
Jean-Serge_Biro
Correct answer by
Community Advisor
Community Advisor

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
Jean-Serge_Biro
Correct answer by
Community Advisor
Community Advisor

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