Programmatically activate asset to preview server in AEM CLOUD SDK | Community
Skip to main content
July 12, 2022
Solved

Programmatically activate asset to preview server in AEM CLOUD SDK

  • July 12, 2022
  • 2 replies
  • 1481 views

Hi Team , 


We are on AEM cloud .. instance   and we I an trying to push  some selective asset to preview server.

So I used 

Replication API.. and  filter and new options . which preview agent ID as the key.

but when I am trying to get the status of activation using the below code:

 

ReplicationStatus publishStatus = res.adaptTo(ReplicationStatus.Class)

publishStatus.getStatusForAgent("preview"). ( compilation error  -> no defined method as getStatusForAgent())

 

But ReplicationStatus API do not have any methods which will confirm if asset has been published on preview server.

 

Can you suggest on this please.

 

regards

Madhu

 

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 madhukumari

Hi Sachin,

 

I too checked the same thing , it was all due to AEM SDK API version , as I switched to different SDK API version it started working .. 

 

Thanks for responding.

 

2 replies

arunpatidar
Community Advisor
Community Advisor
July 12, 2022
July 12, 2022

hi Arun ,

 

Thank you for responding ..I am actually using the same link .... where in afterStatus.getStatusForAgent("preview").  is throwing error ... 

getStatusForAgent is not a method for ReplicationStatus API...  

 

I am trying to look in the API Version ... IF API difference is causing it

 

https://javadoc.io/doc/com.adobe.aem/aem-sdk-api/latest/com/day/cq/replication/package-summary.html   In this Link I see it is a valid method .. 

 

Regards

MAdhu

arunpatidar
Community Advisor
Community Advisor
July 12, 2022

Can you check this from IDE/bundle, which API it is considering?

Arun Patidar
Sachin_Arora_
Community Advisor
Community Advisor
July 13, 2022

This method is available in ReplicationStatus. Please refer below doc for Cloud.

Java Doc : developer.adobe.com/experience-manager/reference-materials/cloud-service/javadoc/com/day/cq/replication/ReplicationStatus.html#getStatusForAgent(java.lang.String)

 

Please share the bundle version you are using of aem-sdk-api. I did not get compilation error with 2022.6 version.

 

madhukumariAuthorAccepted solution
July 13, 2022

Hi Sachin,

 

I too checked the same thing , it was all due to AEM SDK API version , as I switched to different SDK API version it started working .. 

 

Thanks for responding.

 

Sachin_Arora_
Community Advisor
Community Advisor
July 13, 2022

Thanks for confirmation. 

Happy Learning.