Can we publish page using groovy script? | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by EstebanBustamante

Hi, 

Please check this; https://stackoverflow.com/questions/32958010/adobe-cq-aem-groovy-to-activate-a-page

 

Hope this helps

3 replies

narendiran_ravi
New Participant
December 5, 2024

Yes, you can use the method activate(String path) to activate the passing the path ex: activate("/content/page").

EstebanBustamante
EstebanBustamanteAccepted solution
New Participant
December 5, 2024
Esteban Bustamante
Tethich
New Participant
December 5, 2024

@estebanbustamanteI also was not aware about this. Thank you for sharing. I learned smth new today.

Tethich
New Participant
December 5, 2024

Hi @zendark 

Using JS I believe you can do something like:

const bodyParts = new URLSearchParams(); bodyParts.append(':operation', 'activate'); bodyParts.append(':path', '/content/my/page'); fetch('http://localhost:4592/bin/replicate', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Authorization': 'Basic YWRtaW46YWRtaW4=' }, body: bodyParts })

 

I used something like this i a previous post, but for a different use case: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/suggestions-to-extract-content-from-static-json/td-p/718813

I have not tried that js for replication, maybe it has some bugs, but at least might give you a glimpse into what api your groovy script needs to call.