Expand my Community achievements bar.

SOLVED

Create Version of Existing Asset : CURL Script

Avatar

Former Community Member

Hi,

I have a shell script running on AEM server which uploads assets from a shared drive to AEM (6.0 SP2) over regular interval. I am using curl script to ingest this file to AEM although what i am noticing that previous version information of asset is getting lost.

curl -s -u admin:admin -F "jcr:primaryType=dam:Asset" "$aemServer""$aemAssetPath"

curl -s -u admin:admin -F "jcr:primaryType=dam:AssetContent" "$aemServer""$aemAssetPath"/jcr:content

curl -s -u admin:admin -F "jcr:primaryType=nt:folder" "$aemServer""$aemAssetPath"/jcr:content/renditions

curl -s -u admin:admin -F "jcr:primaryType=nt:unstructured" -F "jcr:mixinTypes=cq:Taggable" "$aemServer""$aemAssetPath"/jcr:content/metadata

curl -s -u admin:admin --form original="@$assetName" --form "$assetName@TypeHint"=nt:file "$aemServer""$aemAssetPath"/jcr:content/renditions

Please help. Is there a way i can ingest an asset using script and can also maintain version information (like when we upload existing asset from UI)

Thanks ! 

1 Accepted Solution

Avatar

Correct answer by
Level 10

If you want to automate getting assets into the AEM dam - do not use CURL. Instead - use the AssetManager API:

https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/dam/api/AssetManager.html

Using the AssetManager API is best practice for getting assets into AEM using code. 

You can define a https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/dam/api/Revision.html as well. 

You can use AssetManager within an AEM Sling Servlet - see :

https://helpx.adobe.com/experience-manager/using/multiple-digital-assets.html

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

If you want to automate getting assets into the AEM dam - do not use CURL. Instead - use the AssetManager API:

https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/dam/api/AssetManager.html

Using the AssetManager API is best practice for getting assets into AEM using code. 

You can define a https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/dam/api/Revision.html as well. 

You can use AssetManager within an AEM Sling Servlet - see :

https://helpx.adobe.com/experience-manager/using/multiple-digital-assets.html