Problem with POST request to API

Hello,

I am facing a problem regarding the REST API. I am trying to add a process via POST request as documented here.

My process is defined in XML-format in the file process.xml and looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<definitions id="Definition"
             namespace="http://www.example.org/MinimalExample"
             expressionLanguage="java"
             xmlns="https://www.omg.org/spec/BPMN/20100501/BPMN20.xsd"

  <process processType="Private" isExecutable="true" id="com.sample.HelloWorld" name="Hello World">
    <startEvent id="_1" name="StartProcess" />
    <scriptTask id="_2" name="Hello" >
      <script>System.out.println("Hello World");</script>
    </scriptTask>
    <endEvent id="_3" name="EndProcess" >
        <terminateEventDefinition/>
    </endEvent>
  </process>
</definitions>

I am trying to add this process via the API with the following command:

curl -X POST -H "deployment-name: hello-world" -H "enable-duplicate-filtering: false" -H "deploy-changed-only: false" -H "deployment-source: process application" --data-binary "@process.xml" http://localhost:8080/engine-rest/deployment/create

However, I always get the same error message:

{"type":"NotSupportedException","message":"RESTEASY003065: Cannot consume content type"}

Can anyone help me with my problem? I don’t really see what’s wrong with either the defined process or the POST request.

Thanks in advance,
David

Hi @DaveMitHut,

you should replace the -H with -F. This is the only request (I remember) that uses form-data.

Hope this helps, Ingo

1 Like

Hi @Ingo_Richtsmeier,

thank you for the insight! I completetly missed the part about this request using form-data. After converting all instances of -H to -F as well as adapting the -F-specific syntax, I was able to add my process definition via the API.

Thank you very much.

Kind regards, David