Expand my Community achievements bar.

Activate from script results in incomplete data on publish server

Avatar

Level 3

We have a batch script that is used by one of our business partners to copy newly created or updated photos from a legacy directory to our AEM 6.0 DAM and activate them.  The script uses cURL, (e.g, curl -X POST -F path="/path/to/our/ photos/color-jpg/%3.jpg" -F cmd="activate" http://%logon%@%server%/bin/replicate.json).  An issue we are running  into is the activate is taking place before all renditions are created, so the data on the publish server is incomplete.  Is there another way to prevent setting off the activate too soon besides adding a delay to the script before the activate command?

2 Replies

Avatar

Level 8

Are the photos that are uploaded by this script isolated from other DAM Assets. So in your example in /path/to/our/photos - are there other assets managed by users, or is that path just photos uploaded by your script. If they are just photos uploaded by your script you could create copy of the standard DAM asset workflow and add an activation step at the end. This approach assumes you can create the right patterns in your launchers to achieve this. 

Another option would be if there was some other way to identify the fact that the image was uploaded by script (meta-data for example) you could add a conditional step at the end of standard DAM asset workflow and if the asset met the conditions then trigger replication.

If the photos managed by this script aren't isolated from a path perspective you could consider having you script make restful calls to the author server and check to see if all the renditions have been created. That will make for a much more complicated script but doing that is really the only way to ensure that the renditions are all created. 

To summarize the best option is to figure out how to trigger the replication in workflow instead via script. If you can't find a way to do that then you have to actually code your script to check on the renditions in a loop until they are all created. 

Avatar

Level 3

The path is isolated.  We have a check in our workflow to run different rendition sizes if uploaded to this path.  I tried adding the activate step to the workflow instead of the script before, but ended up running into the same issue.