As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Hello,
I would have my workflow to trigger curl REST API to the other web application.
May I know where/how I can place my curl command in the workflow?
Thanks for your kindly help.
BR,
Mandy
Hi Mandy,
There is multiple ways to accomplish this but probably the easiest is to use Activiti Shell Task.
https://www.activiti.org/userguide/#bpmnShellTask
If you are insisting to use CURL. As an alternative it wold be a good idea to use Camel task or a simpl Java task.
When you say "trigger curl REST api" are you wanting to:
1. make a Rest call to an external REST Service from an activiti service task?
2. Use curl.com API to call Activiti REST API
3. Call a shell script (that executes a curl command)
Not sure what you are asking for.
Greg
Hello Greg,
Thanks for your reply. I am not quite sure the difference between 1. and 3.
The curl command (other application provided) is call to execute do some action on the other application itself.
I tried to execute that curl command separately and it works fine, so I wonder how I can embed into my workflow. So I would like to know how/where to let the workflow call the curl to trigger the other application to do some task itself.
Thank you for your help
Assuming you want to call an external REST service from within an Activiti process flow.
You should use a Service Task.
If you are using Activiti Enterprise edition, there is already a REST service task available in the process designer palette.
If you are using community edition, then you will need to create your own service task to make the REST call.
I have created a simple Rest delegate which you can use as an example here:GitHub - gdharley/activiti-integrations: A collection of simple activiti javadelegates
Hope this helps,
Thank you Grey you provide me a great support.
In case, I'm not familiar with Java and there are some questions would like to ask you about.After I drag out the service task from eclipse, I saw "Java class", "expression", "delegate expression" in the list of Task Type under Properties/Main Config tab. And there is a class name, result variable, skip expression .....
I wonder to know how can I add your code into the service task step?
My restAPI is look like this for your reference:
curl -X POST http://hostname/v2/b8ed2a4e1b294971bf7fb4a679130f58/servers -H "X-Auth-Token:e20363a7c5ba4be0b63caf46fc7d4400" -H "Content-Type: application/json" -d "{\"server\": {\"min_count\": 1, \"flavorRef\": \"1\", \"name\": \"MandyTest-RestAPI\", \"imageRef\": \"fd3a13bd-eb10-48a7-bd8a-2d596efa2c19\", \"max_count\": 1, \"networks\": [{\"uuid\": \"ab2cf228-05a1-49b1-aeab-843575f31f66\"}]}}"
Sorry for my poor knowledge again...