Use case
Create an Adobe Experience Manager (AEM) content package using cURL
cURL to create a package
Below is the syntax and a sample command to create an AEM content package using cURL.
curl -u <user>:<password> -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/mycontent.zip?cmd=create -d packageName=<name> -d groupName=<name>
e.g. curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/mycontent.zip?cmd=create -d packageName=sample-test-package -d groupName=my_packages
After the successful execution of cURL, you will see a successful message.
{"success":true,"msg":"Package created","path":"/etc/packages/my_packages/sample-test-package.zip"}
Successful execution of cURL to create an AEM content package |
Now login to AEM CRX package manager [/crx/packmgr] and verify your newly created package. You will see the package is available with the given name under the created group.
AEM package Manager |
Error
You might see some errors while running this cURL on your machine.
Invoke-WebRequest : Parameter cannot be processed because the parameter name 'u' is ambiguous. Possible matches
include: -UseBasicParsing -Uri -UseDefaultCredentials -UserAgent.
At line:1 char:6
+ curl -u admin:admin -X POST http://localhost:4502/crx/packmgr/service ...
+ ~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameter,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Resolution
Add .exe with curl keyword in command. After that, the cURL looks like this.
curl.exe -u admin:admin -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/mycontent.zip?cmd=create -d packageName=sample-test-package -d groupName=my_packages