管理者は、多くの場合、あらゆるシステム内で一般的なタスクを自動化またはシンプル化する必要があります。 例えば、AEMでは、ユーザーの管理、パッケージのインストール、OSGi バンドルの管理は、一般的におこなう必要があるタスクです。
AEM が構築されている Sling フレームワークの RESTful 特性により、ほとんどのタスクは URL 呼び出しで実行できます。cURL は、このような URL 呼び出しの実行に使用でき、AEM管理者に役立つツールになります。
cURL は、URL 操作を実行するために使用されるオープンソースのコマンドラインツールです。 HTTP、HTTPS、FTP、FTPS、SCP、SFTP、TFTP、LDAP、DAP、DICT、TELNET、FILE、IMAP、POP3、SMTP および RTSP など、様々なインターネットプロトコルをサポートします。
cURL は、URL 構文を使用してデータを取得または送信するための、よく確立され、広く使用されているツールで、元々は 1997 年にリリースされていました。 cURL という名前は、元々は「URL を参照」を意味していました。
AEMが構築される Sling フレームワークの RESTful な性質により、ほとんどのタスクを URL 呼び出しに短縮できます。この呼び出しは、cURL を使用して実行できます。 コンテンツ操作タスク ページのアクティベート、ワークフローの開始、および 運用タスク パッケージの管理やユーザーの管理など、cURL を使用して自動化できます。 また、 独自の cURL を作成する AEMのほとんどのタスク用のコマンド
cURL を使用して実行されるAEMコマンドは、AEMのユーザーと同様に許可される必要があります。 cURL を使用してAEMコマンドを実行する場合、すべての ACL とアクセス権が尊重されます。
cURL は、macOSおよび一部の Linux ディストリビューションの標準部分です。 ただし、ほとんどのオペレーティングシステムで使用できます。 最新のダウンロードは、https://curl.haxx.se/download.html にあります。
cURL のソースリポジトリは、GitHub にもあります。
cURL コマンドは、ワークフローのトリガー、OSGi 設定の確認、JMX コマンドのトリガー、レプリケーションエージェントの作成など、AEMのほとんどの操作に対して構築できます。
特定の操作に必要な正確なコマンドを見つけるには、ブラウザーの開発者ツールを使用して、AEMコマンドの実行時にサーバーに対するPOST呼び出しをキャプチャする必要があります。
次の手順では、例として Chrome ブラウザー内で新しいページを作成する方法を説明します。
AEM内で呼び出すアクションを準備します。 この例では、ページを作成ウィザードの最後まで進みましたが、まだ「作成」はクリックしていません。
開発者ツールを起動し、 ネットワーク タブをクリックします。 次をクリック: ログを保持 オプションを使用して、コンソールをクリアします。
クリック 作成 内 ページを作成 ウィザードを使用して実際にワークフローを作成します。
結果のアクションを右クリックし、「POST」を選択します。 コピー -> cURL としてコピー.
cURL コマンドをテキストエディターにコピーして、コマンドから -H
で始まるすべてのヘッダー(下図の青い部分)を削除し、-u <user>:<password>
などの適切な認証パラメーターを追加します。
コマンドラインで cURL コマンドを実行して、応答を表示します。
一般的な管理タスクと運用タスクに対するAEM cURL コマンドのリストを次に示します。
次の例では、AEM が localhost
のポート 4502
で実行され、ユーザー admin
(パスワード admin
)を使用していると仮定します。追加のコマンドプレースホルダは山括弧で囲んで設定します。
curl -u <user>:<password> http://<host>:<port>/crx/packmgr/service.jsp?cmd=ls
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>
curl -u <user>:<password> -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/mycontent.zip?cmd=preview
curl -u <user>:<password> -X POST http://localhost:4502/crx/packmgr/service/console.html/etc/packages/mycontent.zip?cmd=contents
curl -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/mycontent.zip?cmd=build
curl -u <user>:<password> -X POST http://localhost:4502/crx/packmgr/service/.json/etc/packages/mycontent.zip?cmd=rewrap
curl -u <user>:<password> -X POST -Fname=<New Name> http://localhost:4502/etc/packages/<Group Name>/<Package Name>.zip/jcr:content/vlt:definition
curl -u <user>:<password> -F cmd=upload -F force=true -F package=@test.zip http://localhost:4502/crx/packmgr/service/.json
curl -u <user>:<password> -F cmd=install http://localhost:4502/crx/packmgr/service/.json/etc/packages/my_packages/test.zip
curl -u <user>:<password> -F cmd=uninstall http://localhost:4502/crx/packmgr/service/.json/etc/packages/my_packages/test.zip
curl -u <user>:<password> -F cmd=delete http://localhost:4502/crx/packmgr/service/.json/etc/packages/my_packages/test.zip
curl -u <user>:<password> http://localhost:4502/etc/packages/my_packages/test.zip
curl -u <user>:<password> -FcreateUser= -FauthorizableId=hashim -Frep:password=hashim http://localhost:4502/libs/granite/security/post/authorizables
curl -u <user>:<password> -FcreateGroup=group1 -FauthorizableId=testGroup1 http://localhost:4502/libs/granite/security/post/authorizables
curl -u <user>:<password> -Fprofile/age=25 http://localhost:4502/home/users/h/hashim.rw.html
curl -u <user>:<password> -FcreateUser=testuser -FauthorizableId=hashimkhan -Frep:password=hashimkhan -Fprofile/gender=male http://localhost:4502/libs/granite/security/post/authorizables
curl -u <user>:<password> -FcreateUser=testuser -FauthorizableId=testuser -Frep:password=abc123 -Fmembership=contributor http://localhost:4502/libs/granite/security/post/authorizables
curl -u <user>:<password> -FaddMembers=testuser1 http://localhost:4502/home/groups/t/testGroup.rw.html
curl -u <user>:<password> -FremoveMembers=testuser1 http://localhost:4502/home/groups/t/testGroup.rw.html
curl -u <user>:<password> -Fmembership=contributor -Fmembership=testgroup http://localhost:4502/home/users/t/testuser.rw.html
curl -u <user>:<password> -FdeleteAuthorizable= http://localhost:4502/home/users/t/testuser
curl -u <user>:<password> -FdeleteAuthorizable= http://localhost:4502/home/groups/t/testGroup
詳しくは、バックアップとリストアを参照してください。
curl -u <user>:<password> -Faction=start http://localhost:4502/system/console/bundles/<bundle-name>
curl -u <user>:<password> -Faction=stop http://localhost:4502/system/console/bundles/<bundle-name>
curl -H "CQ-Action: Activate" -H "CQ-Handle: /content/test-site/" -H "CQ-Path: /content/test-site/" -H "Content-Length: 0" -H "Content-Type: application/octet-stream" http://localhost:4502/dispatcher/invalidate.cache
curl -H "CQ-Action: Deactivate" -H "CQ-Handle: /content/test-site/" -H "CQ-Path: /content/test-site/" -H "Content-Length: 0" -H "Content-Type: application/octet-stream" http://localhost:4502/dispatcher/invalidate.cache
curl -u <user>:<password> "http://localhost:4502/etc/replication/agents.author/publish/jcr:content.queue.json?agent=publish"
http://localhost:4502/etc/replication/agents.author/publish/jcr:content.queue.json?agent=publish
curl -X DELETE http://localhost:4502/etc/replication/agents.author/replication99 -u <user>:<password>
curl -u <user>:<password> -F "jcr:primaryType=cq:Page" -F "jcr:content/jcr:title=new-replication" -F "jcr:content/sling:resourceType=/libs/cq/replication/components/agent" -F "jcr:content/template=/libs/cq/replication/templates/agent" -F "jcr:content/transportUri=http://localhost:4503/bin/receive?sling:authRequestLogin=1" -F "jcr:content/transportUser=admin" -F "jcr:content/transportPassword={DES}8aadb625ced91ac483390ebc10640cdf"http://localhost:4502/etc/replication/agents.author/replication99
curl -u <user>:<password> -F "cmd=pause" -F "name=publish" http://localhost:4502/etc/replication/agents.author/publish/jcr:content.queue.json
curl -u <user>:<password> -F "cmd=clear" -F "name=publish" http://localhost:4502/etc/replication/agents.author/publish/jcr:content.queue.json
詳しくは、コミュニティのスコアとバッジを参照してください。
詳しくは、スコアおよびバッジの基本事項を参照してください。
詳しくは、MSRP - MongoDB ストレージリソースプロバイダーを参照してください。
詳しくは、AEM で CRXDE Lite を有効にするを参照してください。
詳しくは、データストアのガベージコレクションを参照してください。
詳しくは、Adobe Analytics および Adobe Target との統合のオプトインを参照してください。
詳しくは、シングルサインオンを参照してください。
コンテンツ操作用のAEM cURL コマンドのリストを次に示します。
次の例では、AEM が localhost
のポート 4502
で実行され、ユーザー admin
(パスワード admin
)を使用していると仮定します。追加のコマンドプレースホルダは山括弧で囲んで設定します。
curl -u <user>:<password> -X POST -F path="/content/path/to/page" -F cmd="activate" http://localhost:4502/bin/replicate.json
curl -u <user>:<password> -X POST -F path="/content/path/to/page" -F cmd="deactivate" http://localhost:4502/bin/replicate.json
curl -u <user>:<password> -F cmd=activate -F ignoredeactivated=true -F onlymodified=true -F path=/content/geometrixx http://localhost:4502/etc/replication/treeactivation.html
curl -u <user>:<password> -X POST -F cmd="lockPage" -F path="/content/path/to/page" -F "_charset_"="utf-8" http://localhost:4502/bin/wcmcommand
curl -u <user>:<password> -X POST -F cmd="unlockPage" -F path="/content/path/to/page" -F "_charset_"="utf-8" http://localhost:4502/bin/wcmcommand
curl -u <user>:<password> -F cmd=copyPage -F destParentPath=/path/to/destination/parent -F srcPath=/path/to/source/location http://localhost:4502/bin/wcmcommand
詳しくは、プログラムによるワークフローとのやり取りを参照してください。
curl -u <user>:<password> -F jcr:primaryType=sling:Folder http://localhost:4502/etc/test
curl -u <user>:<password> -F :operation=delete http://localhost:4502/etc/test/test.properties
curl -u <user>:<password> -F":operation=move" -F":applyTo=/sourceurl" -F":dest=/target/parenturl/" https://localhost:4502/content
curl -u <user>:<password> -F":operation=copy" -F":applyTo=/sourceurl" -F":dest=/target/parenturl/" https://localhost:4502/content
curl -u <user>:<password> -F"*=@test.properties" http://localhost:4502/etc/test
curl -u <user>:<password> -F"test2.properties=@test.properties" http://localhost:4502/etc/test
curl -u <user>:<password> -F "*=@test.properties;type=text/plain" http://localhost:4502/etc/test
詳しくは、Assets HTTP API を参照してください。