Deployment REST API

Hi,
I have deployed camunda as a docker container using docker_compose.yaml file (Camunda 8.6).
I want to deploy the bpmn workflow file using REST API.
But I could not able to deploy using curl command / postman.
Using curl command:

    curl  -X POST 'http://x.x.x.x:26500/v2/deployments' -H 'Content-Type: multipart/form-data' -H 'Accept: application/json' -F 'resources=@kayal_Demo_QOD_Workflow_1_testing.bpmn'
ERROR: curl: (1) Received HTTP/0.9 when not allowed

ZEEBE CONTAINER LOGS:

  Nov 14, 2024 10:26:12 AM io.grpc.netty.NettyServerTransport notifyTerminated
INFO: Transport failed
io.netty.handler.codec.http2.Http2Exception: Unexpected HTTP/1.x request: POST /v2/deployments
        at io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:107)
        at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.readClientPrefaceString(Http2ConnectionHandler.java:315)
        at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:245)
        at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:451)
        at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:530)
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:469)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1407)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918)
        at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:799)
        at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:501)
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:399)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:994)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Unknown Source)

Can anyone help to resolve this issue?

Thank you.

Hi @Kayal_Vizhi and welcome to the forum.

The problem comes from the server expecting a HTTP2 request I think.
Maybe this flag helps for the curl command:

--http2-prior-knowledge

See this link:

Hi @rohwerj,
Now I could able to access curl command.
But after executing the curl ( Content-Type ‘multipart/form-data; boundary=------------------------c85114a79fddf60f’ is not supported) this error has been thrown.
In the camunda 8, deployment REST API. Bpmn file and tenant id is required ,Which is form data format.

Not really sure how this would look with curl.
But I guess you need at least the option -F ‘tenantId=XXX’ to send the tenantId parameter.

In the documentation of camunda 8 , it shows content type multipart/form-data. But after executing the command it is showing not supported. Could you please tell me the correct format for deployment REST API?

I think it should be like this:

curl 'https://localhost'\
  --form "tenantId=XXX;type=text/plain"
  --form "resources=@process.bpmn;type=application/octet-stream"\
1 Like

The curl command:
curl --http2-prior-knowledge -X POST ‘http://x.x.x.x:26500/v2/deployments’ -H ‘Accept: application/json’ -F “tenantId=default;type=text/plain” -F ‘resources=@kayal_Demo_QOD_Workflow_1_testing.bpmn;type=application/octet-stream’
Error message:
Content-Type ‘multipart/form-data; boundary=------------------------656300b0703b2523’ is not supported

Deployment REST API is not working.

Hi! Welcome to the forums!

From what I recall, the 26500 port is not the address of the REST interface, but the GRPC interface. This is also why it’s expecting http/2.

From the Docker Compose File I would expect that the call should be something along the lines of

curl -X POST ‘http://x.x.x.x:8088/v2/deployments’ -H ‘Accept: application/json’ -F “tenantId=default;type=text/plain” -F ‘resources=@kayal_Demo_QOD_Workflow_1_testing.bpmn;type=application/octet-stream’
1 Like

As @GotnOGuts mentioned, 26500 is grpc port. Find out your Rest API Port from your configuration.

As we are running Self Hosted, we can skip the tenant details.

When I ran the command as it is, got the error, saying resource is not found. After fine tuning the call, able to deploy the bpmn using REST API.

Here is the result:

C:\camunda\v8>curl -X POST “http://192.168.101.152:8088/v2/deployments” -H “Accept: application/json” -F “tenantId=default;type=text/plain” -F ‘resources=@demo.bpmn;type=application/octet-stream’
{“type”:“about:blank”,“title”:“Bad Request”,“status”:400,“detail”:“Required part ‘resources’ is not present.”,“instance”:“/v2/deployments”}

C:\camunda\v8>curl -X POST “http://192.168.101.152:8088/v2/deployments” -H “Accept: application/json” -F “resources=@demo.bpmn;type=application/octet-stream”

Result:

{“deploymentKey”:2251799813695150,“deployments”:[{“processDefinition”:{“processDefinitionId”:“Process_0tzg1e6”,“processDefinitionVersion”:1,“processDefinitionKey”:2251799813695151,“resourceName”:“demo.bpmn”,“tenantId”:“”}}],“tenantId”:“”}

1 Like

Thank you everyone.
Now I could able to deploy bpmn workflow using REST API.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.