2 years ago

#60970

test-img

AmonAzhelart

Start Camunda process via rest api with file variable

how is it possible to start a process from rest api, passing it a file? I am working with camel, and I use the routes written on xml

I need to add a variable of type File in the body

my code:

<routes xmlns="http://camel.apache.org/schema/spring">
    <route id="StartProcessCamunda">
        <from uri="file:/input?move=processed/${date:now:dd-MM-yyyy}/${file:name}"/>  
            
        <setHeader name="Content-Type">
            <constant>application/json</constant>
        </setHeader>

        <setBody>
            <simple>
            {
                "variables": {
                    "FileName": {
                        "value": "${headers.CamelFileName}",
                        "type": "String"
                    },
                    "FilePath": {
                        "value": "${headers.CamelFilePath}",
                        "type": "String"
                    },
                    "FilepProcessPath": {
                        "value": "${headers.CamelFileParent}/processed/${date:now:dd-MM-yyyy}",
                        "type": "String"
                    },
                    "FileExt": {
                        "value": "${file:ext}",
                        "type": "String"
                    }
                }
            }
            </simple>
        </setBody>

        <to uri="http://192.168.1.200:8085/engine-rest/process-definition/key/Calcolatrice_TEST/start"/> 

       
    </route>
    
   
</routes>

camunda

0 Answers

Your Answer

Accepted video resources