Hi,
I am trying to call the export proxy management api through node js script and save in local directory
Referring to -
var download_proxy_call = {
url: "https://"+ username + ":" + password +"@api.enterprise.apigee.com/v1/organizations/test26/apis/"+proxyname+"/revisions/"+revisions_count+"?format=bundle",
method: 'GET',
headers: {
'Content-Type': 'application/zip'
} };
request(download_proxy_call, (err, res, body) => {
if (err) { return console.log(err); }
else{
filename="abc.zip";
fs.writeFileSync(filename,body);
}
The file is created successfully but during unzip i encounter the file format exception.
“Unable to expand. error 21 is a directory”
I understand through curl we can download the zip with -o parameter as given in the reference url above and snippet below, but not sure how to save the file through api call via node js -
curl https://api.enterprise.apigee.com/v1/o/myOrg/apis/myProxy/revisions/1?format=bundle
-u myEMail:myPWord -o myProxy.zip
Thanks,
Aakash