AEM Cloud - How to unpublish a page through API ? | Community
Skip to main content
Level 2
November 17, 2023
Solved

AEM Cloud - How to unpublish a page through API ?

  • November 17, 2023
  • 1 reply
  • 1022 views

Hi,

 

I have a servlet written with path and when executed I want it to unpublish a page in AEM Cloud. As AEM Cloud uses sling distribution and not replication agent anymore, I am not sure how to write the JAVA code to unpublish a page.

 

Below is the servlet path. I have the page hard-coded in the code for testing purposes. And I want to execute it only on Author and want the page to be unpublished.

 

Servlet path: http://localhost:4502/bin/deactivate

 

Could someone please help with sharing the java code snippet to unpublish the page in AEM cloud?. Thank you 🙂

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 Harwinder-singh

@karthicksridharan  you can use the replication API.

The actual operation will look something like this - 

replicator.replicate(session,ReplicationActionType.DEACTIVATE,"/content/abc/def");

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/operations/replication.html?lang=en#replication-api

 

1 reply

Harwinder-singh
Community Advisor
Harwinder-singhCommunity AdvisorAccepted solution
Community Advisor
November 17, 2023

@karthicksridharan  you can use the replication API.

The actual operation will look something like this - 

replicator.replicate(session,ReplicationActionType.DEACTIVATE,"/content/abc/def");

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/operations/replication.html?lang=en#replication-api

 

Level 2
November 17, 2023

Thanks @harwinder-singh for the response. Let me try that out. 🙂