# REST Activity Feature

**URL:** <https://forum.flowable.org/t/rest-activity-feature/380>\
**Category:** Flowable Application\
**Created:** [March 1, 2017, 10:25pm UTC](https://forum.flowable.org/t/rest-activity-feature/380 "2017-03-01T22:25:54Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![h7kanna](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/h7kanna/32/104_2.png) [@h7kanna](https://forum.flowable.org/u/h7kanna)\
**Post date:** [April 3, 2017, 1:16am UTC](https://forum.flowable.org/t/rest-activity-feature/380/21 "2017-04-03T01:16:31Z")

</div>

Hi @Sibok666,

I would like to help with development of this feature.  
Please let me know If I can be of any help.

Thanks,  
Harsha

---

<div class="post-metadata">

**Author:** ![Sibok666](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/sibok666/32/292_2.png) [@Sibok666](https://forum.flowable.org/u/Sibok666)\
**Post date:** [April 3, 2017, 2:55pm UTC](https://forum.flowable.org/t/rest-activity-feature/380/22 "2017-04-03T14:55:11Z")

</div>

hi @h7kanna for sure you can help, please take a look at my repo for seeing the changes i have maded to the code.

I think that if we can code all the feature with the

callRestService(String protocol,String host, Integer port, String restPath, Map\<String,String\> inputParameters)

tha its a very simple aproach to the rest call, after that it will be more easy to implement the specification that youre saying.

Tell me if you have doubt about my code and the changes in my repo.

---

<div class="post-metadata">

**Author:** ![h7kanna](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/h7kanna/32/104_2.png) [@h7kanna](https://forum.flowable.org/u/h7kanna)\
**Post date:** [April 3, 2017, 4:07pm UTC](https://forum.flowable.org/t/rest-activity-feature/380/23 "2017-04-03T16:07:04Z")

</div>

Hi @Sibok666,  
Thank you, will start looking into the changes.

Harsha

---

<div class="post-metadata">

**Author:** ![Sibok666](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/sibok666/32/292_2.png) [@Sibok666](https://forum.flowable.org/u/Sibok666)\
**Post date:** [April 4, 2017, 5:37pm UTC](https://forum.flowable.org/t/rest-activity-feature/380/24 "2017-04-04T17:37:39Z")

</div>

Hi @tijs, I do a lot of changes, maybe Im nod doing the things correctly, I think the most important thibg that I do in my latest commit to my repo was add the next class:

/\*\*

- @author Alfredo Suarez  
\*/  
public class RestTaskJsonConverter extends BaseBpmnJsonConverter {

Where I get the properties that the user is going to put on the modeler app.

How can I get thesse values in the RestCallActivityBehavior?

So If I can get thesse values, the input párameters, on Behavior activity will be no more hardcoded.

In general terms, I have modified the classes where exist a mule task call to add a rest call here are the classe I have modified until now.

Please give a clue of whats next?

![](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/flowable/original/1X/04280138bd213d4cff5e9694b32cd589ea0e1367.png)

---

<div class="post-metadata">

**Author:** ![Sibok666](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/sibok666/32/292_2.png) [@Sibok666](https://forum.flowable.org/u/Sibok666)\
**Post date:** [April 4, 2017, 8:29pm UTC](https://forum.flowable.org/t/rest-activity-feature/380/25 "2017-04-04T20:29:40Z")

</div>

Hi @h7kanna any suggestions?

---

<div class="post-metadata">

**Author:** ![h7kanna](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/h7kanna/32/104_2.png) [@h7kanna](https://forum.flowable.org/u/h7kanna)\
**Post date:** [April 5, 2017, 3:30am UTC](https://forum.flowable.org/t/rest-activity-feature/380/26 "2017-04-05T03:30:36Z")

</div>

Hi @Sibok666,

Please check your message box.  
Will discuss these changes further.

Thanks,  
Harsha

---

<div class="post-metadata">

**Author:** ![tijs](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@tijs](https://forum.flowable.org/u/tijs)\
**Post date:** [April 5, 2017, 7:34am UTC](https://forum.flowable.org/t/rest-activity-feature/380/27 "2017-04-05T07:34:49Z")

</div>

Ok thanks. From what I see on your Github fork, the RestCallActivityBehavior implementation is still a bit empty. I think we first need a full implementation of the RestCallActivityBehavior class with a good amount of unit tests, testing the REST task behavior, also when used in BPMN XML. So I think that would be my suggestion as the next steps.

Best regards,

Tijs

---

<div class="post-metadata">

**Author:** ![Sibok666](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/sibok666/32/292_2.png) [@Sibok666](https://forum.flowable.org/u/Sibok666)\
**Post date:** [April 5, 2017, 3:19pm UTC](https://forum.flowable.org/t/rest-activity-feature/380/28 "2017-04-05T15:19:33Z")

</div>

Thanks @tijs Ill work on them.

So I need to start to look at some test.

Harsha and me are talking about the changes needed to be done.

When we have any advance we will update you.

Best regards.

---

<div class="post-metadata">

**Author:** ![jchayes](https://avatars.discourse-cdn.com/v4/letter/j/977dab/32.png) [@jchayes](https://forum.flowable.org/u/jchayes)\
**Post date:** [April 6, 2017, 1:34pm UTC](https://forum.flowable.org/t/rest-activity-feature/380/29 "2017-04-06T13:34:51Z")

</div>

Is the REST service task run asynchronously or as some type of blocking call?

---

<div class="post-metadata">

**Author:** ![h7kanna](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/h7kanna/32/104_2.png) [@h7kanna](https://forum.flowable.org/u/h7kanna)\
**Post date:** [April 7, 2017, 12:01am UTC](https://forum.flowable.org/t/rest-activity-feature/380/30 "2017-04-07T00:01:51Z")

</div>

Hi @jchayes,

Implementation I am working on is synchronous( will block the thread running the service task), because it will be part of the transaction.  
I’m not sure how this could be asynchronous. Any ideas?

Thanks,  
Harsha

---

<div class="post-metadata">

**Author:** ![h7kanna](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/h7kanna/32/104_2.png) [@h7kanna](https://forum.flowable.org/u/h7kanna)\
**Post date:** [April 7, 2017, 1:08am UTC](https://forum.flowable.org/t/rest-activity-feature/380/31 "2017-04-07T01:08:49Z")

</div>

Hi @tijs,

Planning to use Jetty as mock server for unit tests.  
Do you have any suggestion/conditions?

Thanks,  
Harsha

---

<div class="post-metadata">

**Author:** ![tijs](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@tijs](https://forum.flowable.org/u/tijs)\
**Post date:** [April 7, 2017, 3:21pm UTC](https://forum.flowable.org/t/rest-activity-feature/380/32 "2017-04-07T15:21:20Z")

</div>

Hi @h7kanna,

I would suggest to use the unit tests of the flowable-rest module as a starting point.  
It’s also using Jetty.

Best regards,

Tijs

---

<div class="post-metadata">

**Author:** ![h7kanna](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/h7kanna/32/104_2.png) [@h7kanna](https://forum.flowable.org/u/h7kanna)\
**Post date:** [April 23, 2017, 10:23pm UTC](https://forum.flowable.org/t/rest-activity-feature/380/33 "2017-04-23T22:23:59Z")

</div>

Hi @tijs,

Need a clarification on this.

Should the HTTP Task/Behavior be in a separate project like flowable-mule and flowable-camel?  
Is it ok to have it in flowable-engine module itself. This would lead to hard dependency for flowable-engine on apache http client?

Also thinking if it is a separate module like flowable-mule, multiple implementations based on different type of http clients(apache, jetty, okhttp, java9) libraries can be possible without hard dependency for flowable-engine.

Thanks,  
Harsha

---

<div class="post-metadata">

**Author:** ![tijs](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@tijs](https://forum.flowable.org/u/tijs)\
**Post date:** [April 24, 2017, 5:33pm UTC](https://forum.flowable.org/t/rest-activity-feature/380/34 "2017-04-24T17:33:07Z")

</div>

Hi Harsha,

Having a separate module makes a lot of sense I think.

Best regards,

Tijs

---

<div class="post-metadata">

**Author:** ![h7kanna](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/h7kanna/32/104_2.png) [@h7kanna](https://forum.flowable.org/u/h7kanna)\
**Post date:** [April 24, 2017, 5:48pm UTC](https://forum.flowable.org/t/rest-activity-feature/380/35 "2017-04-24T17:48:07Z")

</div>

Thanks @tijs,

Creating a separate module for it called ‘flowable-http’.

Also the HTTP service task is of type ‘http’

serviceTask id=“simpleGet” flowable:type=“http”

@Sibok666 Will commit changes to my fork this week, we can coordinate further on this.

Thanks,  
Harsha

---

<div class="post-metadata">

**Author:** ![h7kanna](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/h7kanna/32/104_2.png) [@h7kanna](https://forum.flowable.org/u/h7kanna)\
**Post date:** [May 1, 2017, 8:30am UTC](https://forum.flowable.org/t/rest-activity-feature/380/36 "2017-05-01T08:30:10Z")

</div>

Hello @tijs,

Before moving forward with my commits.  
I want to confirm if the below HTTP Task spec is good.  
Please review, so that I can go ahead, commit and raise pull request for implementation specific commits.

[https://github.com/h7kanna/flowable-engine/blob/b3b5e8f3c180c16913bd267b99da823a64f14234/userguide/src/en/ch07b-BPMN-Constructs.adoc](https://github.com/h7kanna/flowable-engine/blob/b3b5e8f3c180c16913bd267b99da823a64f14234/userguide/src/en/ch07b-BPMN-Constructs.adoc)

Thanks,  
Harsha

---

<div class="post-metadata">

**Author:** ![tijs](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@tijs](https://forum.flowable.org/u/tijs)\
**Post date:** [May 1, 2017, 9:00am UTC](https://forum.flowable.org/t/rest-activity-feature/380/37 "2017-05-01T09:00:03Z")

</div>

Hi Harsha,

Thanks, it’s looking very good. Couple of points:

- could you keep HTTPClientConfig lower case in the process engine config, so httpClientConfig?
- do you also allow expressions in the requestUrl and requestHeaders field extensions? I would guess so, but just to verify.
- I’m curious about the retry feature, are you using async jobs for this or something else?
- Maybe a resultVariable name would also be good as a property, so you can define the execution variable where you want to store the response.
- Authentication is an important part of the HTTP task, so maybe it would be good to add a specific property to add a http request header or another token in the HTTP request for authentication purpose.
- It might also be nice to be able to define a response parser, so you can easily inject some logic to set certain parts of the response as execution variables.

These are not all points for a version 1 implementation, but just stuff that crossed my mind.

Best regards,

Tijs

---

<div class="post-metadata">

**Author:** ![h7kanna](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/h7kanna/32/104_2.png) [@h7kanna](https://forum.flowable.org/u/h7kanna)\
**Post date:** [May 1, 2017, 9:27am UTC](https://forum.flowable.org/t/rest-activity-feature/380/38 "2017-05-01T09:27:27Z")

</div>

Hi @tijs,

- Will change HTTPClientConfig to httpClientConfig.

- expressions are allowed as mentioned.

- Retry feature would be Http Client retrying the request( we can set this by configuring retry handler on apache client). This is just for resiliency for temporary network issues. As sync job is concerned, I am planning to throw Flowable exception based on ignore,retry settings so that Job Executor retries based on ‘flowable:failedJobRetryTimeCycle’. I am not sure if this can be implemented like Camel receive task.

- Updated resultVariables handling. Needed a clarification though. I am using a prefix value to give variables unique names in the execution. Will ‘taskId.fieldName’ suffice to make it unique? User can override this by ‘variableNamePrefix’

- Will start working on Authentication, Request parsing once version 1 is done and reviewed.

Thanks,  
Harsha

---

<div class="post-metadata">

**Author:** ![tijs](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@tijs](https://forum.flowable.org/u/tijs)\
**Post date:** [May 1, 2017, 9:32am UTC](https://forum.flowable.org/t/rest-activity-feature/380/39 "2017-05-01T09:32:37Z")

</div>

Hi Harsha,

Great thanks. Let’s say you are getting back a JSON object like:

{“customer”: {“name”:“John Doe”, “address”: “Some street”, “houseNumber”: “34a”}}

How would that translate in execution variables?

Best regards,

Tijs

---

<div class="post-metadata">

**Author:** ![h7kanna](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/h7kanna/32/104_2.png) [@h7kanna](https://forum.flowable.org/u/h7kanna)\
**Post date:** [May 1, 2017, 9:55am UTC](https://forum.flowable.org/t/rest-activity-feature/380/40 "2017-05-01T09:55:59Z")

</div>

Hi,

taskId.responseBody = {“customer”: {“name”:“John Doe”, “address”: “Some  
street”, “houseNumber”: “34a”}}

Next we can have ‘responseFilter’ field expression which evaluates to say  
something like

jsonProcessor.extractAddress(taskId.responseBody)

Thanks,  
Harsha

[Previous page](https://forum.flowable.org/t/rest-activity-feature/380.md?page=1)

[Next page](https://forum.flowable.org/t/rest-activity-feature/380.md?page=3)
