Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Importing assets using ACS Commons URL Asset Import

Avatar

Level 2

Hi Team,
Our requirement is to import assets presents in network mounted drive. We decided to use ACS Commons URL Asset Import. This fits to our requirement and importing assets in lower environment.

But in higher environments, We can't perform any step manually. Everything has to be done either using some job or some utility. We are not allowed to create/start process manually. 
Is there any way I can trigger URL Asset Import by using API or some other means.

Any help/approach please

7 Replies

Avatar

Community Advisor

Hi @jnmatthew ,
You can execute this using curl or rest call using any client ex.  postman

Avatar

Level 2

@sunil_kumar_could you please share sample curl. Or there is any process to get curl

Avatar

Community Advisor

@jnmatthew This has been tested on MAC/Terminal. May need to adjust as per OS/Terminal in case you face encoding related issue. 

curl -u admin:admin POST 'http://localhost:4502/apps/acs-commons/content/manage-controlled-processes/jcr:content.start.json' \
--form 'definition="URL Asset Import"' \
--form 'retryPause="200"' \
--form 'dryRunMode="true"' \
--form 'jcrBasePath="/content/dam"' \
--form 'importFile=@"/Users/<your-path-to-file>/url-asset-import-example.xlsx"' \
--form 'filename="url-asset-import-example.xlsx"' \
--form 'defaultPrefix="nfile"' \
--form 'timeout="30000"'

I used only required parameters. Add other parameters as per your need.

Avatar

Level 2

Thanks, It is working for me. Don't have any utility or process to get curl for operations. It almost impossible to memories curl for different operations.

Avatar

Community Advisor

@jnmatthew You can get curl at high level from your browser. I prefer chrome. 

When you perform any operation. 
Go to Network tab. On your specific call. Right click and copy as curl. You will get curl with headers. Remove headers and adjust as per your need.  You have to -u to add credentials. 
By using this, you will get only high level curl.

Using postman- Set rest call in postman. Once your rest call work as expected. Copy as curl. You have to adjust that with -u and remove token. means adjust so that you can use this in terminal to Jenkins.
I hope this will help.

Avatar

Community Advisor

@jnmatthew Sample curl command to execute the servlet :

curl -u <username>:<password> -i -XPOST http://<domain-name>:<domain-port>/<servlet-path>

and if you want to pass the file along with it, you can use:

curl -u <username>:<password> -i -XPOST -F "file=@<filepath>" http://<domain-name>:<domain-port>/<servlet-path>

Some of the other examples of the curl commands can be found in the below link:

https://experienceleague.adobe.com/docs/experience-manager-64/administering/operations/curl.html?lan...

Thanks