cURL is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNETand TFTP). The command is designed to work without user interaction.
With AEM, you can use cURL commands to modify repository, download json, access OSGi information etc.
Snippet to download a json file via cURL:
While majority of the AEM’s content information can be downloaded via HTTP connection, cURL command can be used to download information from AEM’s OSGi console.
In the shared example, we have used cURL to get information about all the bundles installed in AEM.
Snippet to execute a cURL command:
The follwoing snippet contains acURL command that has been converted in a format to be used in Java snippet.
The cURL command used here is meant to lock page “/content/geometrixx/en/toolbar/contacts” :
curl -u admin:admin -X POST -F cmd=”lockPage” -F path=”/content/geometrixx/en/toolbar/contacts” -F “_charset_”=”utf-8” http://localhost:4502/bin/wcmcommand
For more samples of cURL commands, please refer to: