常见操作AEM cURL命令

以下是常见管理和操作任务的AEM cURL命令列表。

NOTE
以下示例假定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

备份

请参阅 备份和恢复 以了解详细信息。

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在 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

工作流

请参阅 以编程方式与工作流交互 以了解详细信息。

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

资产处理

请参阅 资产HTTP API 以了解详细信息。

Experience Manager