how activiti include curl REST API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2017 05:21 AM
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
- Labels:
-
Alfresco Process Services

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2017 07:23 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2017 08:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2017 10:57 PM
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
Mandy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2017 03:33 AM
Hi Mandy,
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,
Greg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2017 11:01 PM
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...
Mandy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 11:08 AM
The JavaDelegate includes a number of properties you need to define in the call.
These properties are noted at the top of the class:
endpointUrl - http://hostname/v2/b8ed2a4e1b294971bf7fb4a679130f58/servers
httpMethod - POST
isSecure _ false
payload - Your JSON payload
headers -[{ "name" : "X-Auth-Token", value : "e20363a7c5ba4be0b63caf46fc7d4400"},{"name" : "Content-Type", "value" : "application/json"}]
responseMapping - variable you want to send the response json to.
This should be enough to get you moving ahead.
Greg
