Invoke workflow process using Curl command : could not connect to host | Community
Skip to main content
Level 2
October 16, 2015
Solved

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

  • October 16, 2015
  • 7 replies
  • 3228 views

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

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 joerghoh

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

7 replies

smacdonald2008
Level 10
October 16, 2015

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. 

Sham_HC
Level 10
October 16, 2015
Level 2
October 16, 2015

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

Level 2
October 16, 2015

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

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

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

smacdonald2008
Level 10
October 16, 2015

"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

smacdonald2008
Level 10
October 16, 2015

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