Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

deleting only child pages using curl in cq5

Avatar

Level 3

I am trying to delete only child pages using curl in CQ5 with this command

curl -X DELETE http://%HOSTAUTHOR%:%PORTAUTHOR%/content/a/b/c/d/e/f/g/ -u %USER%:%PASSWORD%

I want only the pages under /content/a/b/c/d/e/f/g/ to be deleted and not the 'g' page. But the parent page also gets deleted.

Trying

curl -X DELETE %HOSTAUTHOR%:%PORTAUTHOR%/content/a/b/c/d/e/f/g/* -u %USER%:%PASSWORD%

does not delete anything

and trying

curl -X DELETE %HOSTAUTHOR%:%PORTAUTHOR%/content/a/b/c/d/e/f/g -u %USER%:%PASSWORD%

deletes the 'g' page as well.

Can anybody help me in writing the correct syntax so that only the pages under /content/a/b/c/d/e/f/g/ get deleted and not the whole 'g' page as well?

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi Jeeshan,

 

Thanks for you reply. The mentioned method

$ curl -F":operation=delete" -F":applyTo=/content/*" http://host/content/sample

 

deletes the '/content/' page's jcr:content node as well. Looking for a way in which the child pages are deleted and the parent page's jcr:content node remains intact.

Thanks

View solution in original post

3 Replies

Avatar

Correct answer by
Level 3

Hi Jeeshan,

 

Thanks for you reply. The mentioned method

$ curl -F":operation=delete" -F":applyTo=/content/*" http://host/content/sample

 

deletes the '/content/' page's jcr:content node as well. Looking for a way in which the child pages are deleted and the parent page's jcr:content node remains intact.

Thanks

Avatar

Level 3

The info that I got was that using the apply:To parameter; multiple nodes can be deleted.

As mentioned here https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-po...

But it deletes parent page's jcr:content node as well. Is there a way that only the child pages get deleted and not the parent page' jcr:content node using curl? Its mentioned here

http://stackoverflow.com/questions/31240397/deleting-only-child-pages-using-curl-in-cq5

that regex or globbing is not supported; still; if anyone knows how to achieve this; will help a lot.

 

Thanks