What should I do service task makes REST call?

What should I do service task makes REST call?
‘http-connector’ is really some connector ready to use name or just example name?

Suppose I want service task make POST call to http://host/source with payload:

{
  "data": {
    "dept": {
      "value": "marketing"
    },
        "date": {
      "value": "2021-03-21"
    }
  }
}

Where ‘dept’ and ‘date’ are process variables . What should I enter there?

Connectors are pretty ok to use when you’re getting started but they’re very basic and have a lot of drawbacks as you move towards a production-ready system.

Depending on your setup i would suggest either using a Java Class and write the call directly in there or use and External Task if you don’t want to use Java.

1 Like

Hi @Niall

Is there any community version of connector implementation in Java (service task ) already available to refer.

To make a rest call you don’t really need any camunda specific implementation. you can simply use whichever java libs you like to make the call.

1 Like

So connectors are just jokes…
I’ve gone through tons of documentation and yt videos and I don’t understand any of it. Nowhere have I found information which file needs to be exactly modified or where to add a new one. Usually these are ‘add class’ tips (but where?). Could you be so kind as to provide a sample file with instructions on where it must be placed?

Or… how to use this ‘external task’? Is there any way I can simply send few values to database without writing million lines of code in Java?

Hi @mkelton

Maybe you can explain in detail what you’re trying to achieve, there are usually lots of ways of achieving the same thing with Camunda and it often depends on what your preference is. This can be seen as being quite confusing i’m sure. With a little more information from you i’m sure i can help you understand the best option and probably find some samples for you to look at.

Sure. I know BPM notation but I’m not experienced at all with BPMN platform. I think Camunda would help me to organize information flow layer in my application.

I figured that instead of building functions that would pass certain information for approval, I’d organize decision flow with camuda. So I will initiate the approval process in the application and I application only check that all acceptance points have approved the request. Some acceptance points require more than just clicking “Yes” (or not) so I imagine Camunda should return some information to the table, eg that this is “X level” of acceptance. I think that’s how it is done with BPMN and such software returns some information to the application; what form to display, what component the user should see at this stage, etc. Right?

I was hoping that in the modeler I would simply add a connection to the base with a few clicks (because why write the script again for the activity that is performed in 2354465467435323 other installations of the BPMN platforms) but unfortunately not.
So I need a database (best) or REST connection. I hope someone has already written such a script and I won’t have to write it again. Yes, of course, I may want a different data parsing, a different data format, but that’s the detail.

When you use http-connector , make sure you provide the below input parameters with the same name- headers, url , method and payload. In the payload variable , you can build you json that the API endpoint expects. The output parameter can be as per your requirement.

Thank you!
What you have in Output parameters? Could you please expand this section?

How about performace - will work :slight_smile:

Here is the output result

. My API endpoint is returning boolean “status” field in response. We were advised to use External implementation for service task. Also noticed that the http-connector does not handle technical exceptions (for example , API endpoint connection failure , SSL errors , Authentication errors). I would advise to use External implementation for service task and handle that in your code. Camunda is for Business Process and leave the low level technical plumbing out of the process model.

1 Like

Thank you very much for your help!