常見操作AEM cURL命令

以下是常見管理和操作任務的AEM cURL命令清單。

NOTE
下列範例假設AEM正在執行 localhost4502 和使用使用者 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

備份

請參閱 備份和還原 以取得詳細資訊。

OSGi

啟動套件組合

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>

Dispatcher

使快取失效

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重新索引

請參閱 MSRP - MongoDB儲存資源提供程式 以取得詳細資訊。

安全性

啟用和禁用CRX DE Lite

請參閱 在AEM中啟用CRXDE Lite 以取得詳細資訊。

資料存放庫廢棄項目收集

請參閱 資料儲存垃圾收集 以取得詳細資訊。

Analytics與Target整合

請參閱 選擇加入Adobe Analytics和Adobe Target 以取得詳細資訊。

單一登入

傳送測試標題

請參閱 單一登入 以取得詳細資訊。

常見內容操作AEM cURL命令

以下是用於內容操控的AEM cURL命令清單。

NOTE
下列範例假設AEM正在執行 localhost4502 和使用使用者 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

工作流程

請參閱 以程式設計方式與工作流程互動 以取得詳細資訊。

Sling內容

建立資料夾

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

使用Sling PostServlet上傳檔案

curl -u <user>:<password> -F"*=@test.properties"  http://localhost:4502/etc/test

使用Sling PostServlet上傳檔案並指定節點名稱

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 以取得詳細資訊。

Experience Manager