Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

cURL command to download cq package

Avatar

Level 2
Level 2

Hi All,

I want to download package which is created by package manager using cURL command.If anyone come across using this kind of command please share with me.

I have tried below but not succeeded.

curl -k -u "$USER_NAME":"$PASSWORD" -X GET "$URL""$PORT"/etc/packages/my_packages/testpackage123.zip

url -k -u "$USER_NAME":"$PASSWORD" "$URL""$PORT"/etc/packages/my_packages/testpackage123.zip

Thanks In Advance,

Kishore

1 Accepted Solution

Avatar

Correct answer by
Level 10
11 Replies

Avatar

Correct answer by
Level 10

Avatar

Level 2
Level 2

smacdonald2008 wrote...

This is talked about here:

http://www.cqtutorial.com/courses/cq-admin/cq-admin-lessons/cq-maintenance/cq-package-manager

 

Hi,

I have tried as mentioned in the link but still throwing error.

I am accessing my CQ instance, as "https://<hostname>:<port>/wcm_author/projects.html"

curl -k -u "$USER_NAME":"$PASSWORD" "$URL""$PORT"/etc/packages/my_packages/testpackage123.zip

Error:

<html><head><title>JBoss Web/2.1.10 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /etc/packages/my_packages/testpackage123.zip</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/etc/packages/my_packages/testpackage123.zip</u></p><p><b>description</b> <u>The requested resource (/etc/packages/my_packages/testpackage123.zip) is not available.</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/2.1.10</h3></body></html>

Avatar

Level 6

Hi Kishore,

To downlaod please try this

 

curl -u admin:'password' 'http://<>hostname>:<port>/crx/packmgr/download.jsp?_charset_=utf-8&path=/etc/packages/my_packages/packagename.zip'  --O  packagename.zip

Avatar

Level 2
Level 2

Thanks Gokul.I am seeing below error while executing cURL command.

----------------------------------
 Downloading Content Package
----------------------------------
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file testpackage123.zip
  1  489k    1  8801    0     0   118k      0  0:00:04 --:--:--  0:00:04 1432k
curl: (23) Failed writing body (0 != 8801)

curl -k -u admin:<password> 'https://<hostname:port>/wcm_author/crx/packmgr/download.jsp?_charset_=utf-8&path=/etc/packages/my_packages/testpackage123.zip' --O testpackage123.zip

Any idea why i am getting this error?

Thanks,

Kishore

Avatar

Level 6

Hi Kishore,

Please try without .zip .

curl -k -u admin:<password> 'https://<hostname:port>/wcm_author/crx/packmgr/download.jsp?_charset_=utf-8&path=/etc/packages/my_packages/testpackage123.zip' --O XXXX

Avatar

Level 5

for me it works on small case on Windows powershell.

Avatar

Level 2
Level 2

i have tried that too but no luck.

Is this working for you?

Thanks,

Kishore

Avatar

Level 2
Level 2

Finallly ,i have nailed the issue.Below is the final cURL command to download the package.

curl -k -u admin:<password> -X GET -F 'packageName=testpackage123' -F 'path=/etc/packages/my_packages/testpackage123.zip' -F 'groupName=my_packages' -F '_charset_=UTF-8' https://<hostname>:<port>/wcm_author/crx/packmgr/download.jsp --O testpackage123.zip

Thanks everyone for your valuable inputs and time.

Connect Again smiley

Thanks,

Kishore

Avatar

Level 5

This is working for me to download a content package from AEM.

 

curl.exe -u admin:admin 'http://localhost:4502/wcm_author/crx/packmgr/download.jsp?_charset_=utf-8&path=/etc/packages/my_packages/calculator.zip' -o calculator.zip