How exactly should I use PUT/POST in Http task when I am limited to only strings for Request body

Hey everyone,

In request body I can only type out my JSON body, but can’t use variables (ones I got using script task), i.e. ${myVar}, since those are strings with quotation and unsuitable for REST calls.

Any advice on using REST API?

I’m using HTTP tasks for API calls with variables from script tasks without problems. Example:

<serviceTask id="http_example_task" name="HTTP example task" flowable:type="http">
    <flowable:field name="requestMethod">
    <flowable:field name="requestUrl">
    <flowable:field name="requestHeaders">
      <flowable:string><![CDATA[Content-type: application/json]]></flowable:string>
    <flowable:field name="requestBody">
    <flowable:field name="failStatusCodes">

Please mind the flowable:expression when you need to evaluate variable.

1 Like

It seems I can’t set the type from inside the modeler. Any quick workaround?

You don’t need to, when selecting the Http task, the type will be set automatically for you.

That’s true, but I need to set the type of a service task if I want to use those fields.

Which modeler are you using? With the flowable-modeler application has a specific HTTP Task that you can drag and drop and you would be able to add all the information that @jan linked in the modeler


I need the request body to be an expression, not a string. I think it’s string since my test cases failed and I think it’s due to quotation.

Exactly and if you go in the editor and in request body you write: ${bodyExpression} then you will have

<flowable:field name="requestBody">

in your BPMN xml. Can you perhaps share a reproducal with your problem. Perhaps the test case and the BPMN XML. As this should work

1 Like

You are correct. I will reply again If I don’t get it working. Thanks

It works now. First time I downloaded BPMN XML I got the !CDATA[GET] instead of !CDATA[PUT]. But the next day it was PUT, and it everything just worked. I haven’t changed anything in comparison to what I had when I posted the problem.

Thanks for helping out.

unfortunately it gives always flowable:string in request body when the change is made in the modeler,
even when I manually changed the xml to flowable:expression and re’uploaded it, it goes back to string. I just want to send the ${} in the body and everytime it’s sent as a string not the value behind. can you help ?

in cmmn models it’s always string in request body :roll_eyes: I didn’t find a way to make it an expression, in bpmn it’s fine though but we don’t use bpmn models.

I’ve answered this on 2 other posts. Please refrain from creating 4 posts about the same problem.

1 Like