管理者は、多くの場合、システムの一般的なタスクを自動化またはシンプル化する必要があります。例えば、AEM では、ユーザーの管理、パッケージのインストールおよび OSGi バンドルの管理は、一般におこなう必要のあるタスクです。
AEMが構築されるSlingフレームワークのRESTfulの特性により、ほとんどのタスクはURL呼び出しを使用して実行できます。 cURL は、そのような URL 呼び出しの実行に使用でき、AEM 管理者にとって便利なツールです。
cURL は、URL 操作を実行するために使用される、オープンソールのコマンドラインツールです。HTTP、HTTPS、FTP、FTPS、SCP、SFTP、SFTP、TFTP、LDAP、DICT、TELNET、FILE、IMAP、POP3、SMTP、RTSPなど、様々なインターネットプロトコルをサポートしています。
cURL は、URL 構文を使用してデータを取得または送信するための、広く使用される安定したツールで、最初にリリースされたのは 1997 年です。cURL という名前の元々の意味は、「see URL」でした。
AEM が構築されている Sling フレームワークの RESTful 特性により、ほとんどのタスクは URL 呼び出しに集約されます。これは、cURL で実行できます。ページのアクティベートおよびワークフローの開始などのコンテンツ操作タスクやパッケージ管理およびユーザー管理などの運用タスクは、cURL を使用して自動化できます。さらに、AEM のほとんどのタスクについて、独自の cURL を作成できます。
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 内で呼び出したいアクションを準備します。この場合、ページを作成ウィザードの最後まで進んでいますが、まだ作成をクリックしていません。
開発者ツールを開始して、「Network」タブを選択します。コンソールをクリアする前に、「Preserve log」オプションをクリックします。
ページを作成ウィザードの「作成」をクリックして、実際にワークフローを作成します。
結果として表示される POST アクションを右クリックして、Copy/Copy as 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:conten t.queue.json?agent=publish"
http://localhost:4502/etc/replication/agents.author/publish/jcr:content.queue.js on?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.js on
curl -u <user>:<password> -F "cmd=clear" -F "name=publish" http://localhost:4502/etc/replication/agents.author/publish/jcr:content.queue.js on
詳しくは、コミュニティスコアリングとバッジを参照してください。
詳しくは、スコアリングとバッジの初期設定を参照してください。
詳しくは、MSRP - MongoDBストレージリソースプロバイダーを参照してください。
詳しくは、AEM](/docs/experience-manager-64/sites-administering/enabling-crxde-lite.html?lang=ja)での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
詳しくは、アセットHTTP APIを参照してください。