Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Curl commands to delete AEM page cloud service configuration

Alexander-K
Level 1
Level 1

Hi all,

 

I'm trying to create a curl command to delete AEM page cloud service configuration, but can't seem to make it work correctly

 

Server ip address will be used as 1.2.3.4

 

So, I ssh-connect to the server ip via putty and tried to run this command:

curl -u username:password -F :operation=delete http://1.2.3.4:4502/content/companyroot/sitename/en/home/testpage1/jcr:content/cq:cloudserviceconfig...

 

Result: the command timed out with error "curl: (7) failed connect to 1.2.3.4:4502; Connection timed out"

 

I thought that since the server can’t connect to its own ip and port 4502, then I could use localhost, but that didn’t work:

Command: curl -u username:password -F :operation=delete http://localhost:4502/content/companyroot/sitename/en/home/testpage1/jcr:content/cq:cloudserviceconfigs 

Result: nothing. The command is complete, no errors in the console, the page cloud services are not deleted.

 

I tried to record curl command using Chrome development tools, while doing the deletion manually in CRX/DE

Got the following command with some headers, just added username and password to authenticate:

curl -u username:password 'https://author-comany-domain.adobecqms.net/crx/server/crx.default/jcr%3aroot' \
-H 'Connection: keep-alive' \
-H 'X-Requested-With: XMLHttpRequest' \
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36' \
-H 'Content-Type: multipart/form-data; boundary=crxde' \
-H 'Accept: */*' \
-H 'Origin: https://author-comany-domain.adobecqms.net' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Referer: https://author-comany-domain.adobecqms.net/crx/de/index.jsp' \
-H 'Accept-Language: en-US,en;q=0.9' \
--data-binary $'--crxde\r\nContent-Disposition: form-data; name=":diff"\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n-/content/companyroot/sitename/en/home/testpage2/jcr:content/cq:cloudserviceconfigs : \r\n--crxde-- ' \
--compressed

 

Tried to execute that curl command while ssh-connected to the sever, and got error "OakAcess0000: Access denied"

I'm wondering if the last curl command is correct, but fails just due to invalid credentials used?

 

Please advise what's the best approach to programmatically delete AEM page cloud service configuration. Or maybe you can point me at the issue in above curl commands?

 

Thanks

 

Kind regards,

Alexander

1 Accepted Solution
Alexander-K
Correct answer by
Level 1
Level 1

With correct user credentials, I was able to successfully execute curl command that deleted the page cloud config

 

 

curl -u username:password 'https://author-company-domain.adobecqms.net/crx/server/crx.default/jcr%3aroot ' \
-H 'Connection: keep-alive' \
-H 'X-Requested-With: XMLHttpRequest' \
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36' \
-H 'Content-Type: multipart/form-data; boundary=crxde' \
-H 'Accept: */*' \
-H 'Origin: https://author-company-domain.adobecqms.net ' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Referer: https://author-company-domain.adobecqms.net/crx/de/index.jsp ' \
-H 'Accept-Language: en-US,en;q=0.9' \
--data-binary $'--crxde\r\nContent-Disposition: form-data; name=":diff"\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n-/content/companyroot/sitename/en/home/testpage2/jcr:content/cq:cloudserviceconfigs : \r\n--crxde-- ' \
--compressed

View solution in original post

1 Reply
Alexander-K
Correct answer by
Level 1
Level 1

With correct user credentials, I was able to successfully execute curl command that deleted the page cloud config

 

 

curl -u username:password 'https://author-company-domain.adobecqms.net/crx/server/crx.default/jcr%3aroot ' \
-H 'Connection: keep-alive' \
-H 'X-Requested-With: XMLHttpRequest' \
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36' \
-H 'Content-Type: multipart/form-data; boundary=crxde' \
-H 'Accept: */*' \
-H 'Origin: https://author-company-domain.adobecqms.net ' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Referer: https://author-company-domain.adobecqms.net/crx/de/index.jsp ' \
-H 'Accept-Language: en-US,en;q=0.9' \
--data-binary $'--crxde\r\nContent-Disposition: form-data; name=":diff"\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n-/content/companyroot/sitename/en/home/testpage2/jcr:content/cq:cloudserviceconfigs : \r\n--crxde-- ' \
--compressed

View solution in original post