Read in a zip file from API(url) in java | Community
Skip to main content
daver37819942
Level 3
March 7, 2018
Solved

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

  • March 7, 2018
  • 1 reply
  • 2685 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jean-Serge_Biro

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

1 reply

Jean-Serge_Biro
Jean-Serge_BiroAccepted solution
Level 10
March 8, 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