Create Version of Existing Asset : CURL Script | Community
Skip to main content
October 16, 2015
Solved

Create Version of Existing Asset : CURL Script

  • October 16, 2015
  • 1 reply
  • 1395 views

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 ! 

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 smacdonald2008

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

1 reply

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

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