Expand my Community achievements bar.

SOLVED

Programmatically activate asset to preview server in AEM CLOUD SDK

Avatar

Level 2

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

 

1 Accepted Solution

Avatar

Correct answer by
Level 2

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.

 

View solution in original post

6 Replies

Avatar

Level 2

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

Avatar

Community Advisor

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



Arun Patidar

Avatar

Community Advisor

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.

 

Avatar

Correct answer by
Level 2

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.