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.
SOLVED

Invoke workflow process using Curl command : could not connect to host

Avatar

Level 2

Hi All,

As examples given in the URL,  https://docs.adobe.com/docs/en/aem/6-0/develop/extending/workflows/wf-extending/wf-rest-api.html

When I tried using the REST URL in our environment,  got could not connect to host error.

For e.g.   Get the list of running workflow

  http://localhost:4502/etc/workflow/instances.RUNNING               (in browser : gives forbidden access)

  Using Curl command:   curl -u admin:admin http://localhost:4502/etc/workflow/instances.RUNNING.json   (gives error as : could not connect to host)

Same for starting a workflow.

My requirement is to start a workflow using the Curl command, but getting could not connect to host error on localhost author instance. Please advice.

 

Thanks,

Anand

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

when you get the message "could not connect to host", it's a network problem, as your curl is not able to connect to the remote system. So it's not a problem of AEM. Maybe your browser is configure to use proxy, in that case you need to provide this proxy to curl, too.

kind regards,
Jörg

View solution in original post

7 Replies

Avatar

Level 10

Instead of trying to get these CURL commands working -- ie:

http://localhost:4502/etc/workflow/instances.RUNNING        

You have much tighter control by writing a custom Sling Servlet in AEM that invokes the workflow using Workflow API: 

https://helpx.adobe.com/experience-manager/using/invoking-experience-manager-workflows-using.html

Then use CURL or another RESTful tool to invoke the AEM Servlet. 

Avatar

Level 2

Thanks. That's a good alternative. I can try that. Any reason why Curl command not working directly on workflow instance.

Avatar

Level 2

smacdonald2008 wrote...

Instead of trying to get these CURL commands working -- ie:

http://localhost:4502/etc/workflow/instances.RUNNING        

You have much tighter control by writing a custom Sling Servlet in AEM that invokes the workflow using Workflow API: 

https://helpx.adobe.com/experience-manager/using/invoking-experience-manager-workflows-using.html

Then use CURL or another RESTful tool to invoke the AEM Servlet. 

 

 

 

 

Then use CURL or another RESTful tool to invoke the AEM Servlet. 

Need clarification :   Steps;  1- Created workflow process ,

                                2-  creating  custom servlet class which will invoke workflow using workflow API

                                3- Deploy this servlet as bundle in AEM

Question : How this custom servlet class will be exposed as REST URL ?  ( This can be access withing AEM like in any component JSP page, but how do we access this class externally ?)

I want to call this custom servlet URL from external java class as REST URL or curl command.  

Thanks,

Anand

Avatar

Correct answer by
Employee Advisor

Hi,

when you get the message "could not connect to host", it's a network problem, as your curl is not able to connect to the remote system. So it's not a problem of AEM. Maybe your browser is configure to use proxy, in that case you need to provide this proxy to curl, too.

kind regards,
Jörg

Avatar

Level 10

"I want to call this custom servlet URL from external java class."

We have a community article that shows invoking a custom AEM Sling Servlet from a Java Swing app (in this app - we post files from the desktop to an AEM Servlet). However - you will see how to do it: 

 https://helpx.adobe.com/experience-manager/using/post_files.html

Avatar

Level 10

I find CURL to be hit and miss. You have better control over using APIs/Restful requests.