Rest API Error about `POST /deployment/create`

Hi,

I’m trying to deploy a process via rest api.
But the error message “No resource method found for POST, return 405 with Allow header” appeared when I execute POST /deployment/create.
It’s very helpful to let me know how to avoid the error.

“GET /deployment/{id}/resources” works well.

curl 'http://192.168.43.178:8080/camunda/api/engine/engine/default/deployment/b6f32ca3-2dfb-11e6-98d5-08002703433f/resources' \
-H 'Cookie: JSESSIONID=kjcddrwwo1zo1ejsx4bbmek0u' \
-H 'Connection: keep-alive'

[{"id":"b6f32ca5-2dfb-11e6-98d5-08002703433f","name":"pa2/sorting-process.bpmn","deploymentId":"b6f32ca3-2dfb-11e6-98d5-08002703433f"},{"id":"b6f32ca7-2dfb-11e6-98d5-08002703433f","name":"pa2/two-parallel-call-activities-calling-different-process.bpmn","deploymentId":"b6f32ca3-2dfb-11e6-98d5-08002703433f"},{"id":"b6f32ca8-2dfb-11e6-98d5-08002703433f","name":"pa2/two-parallel-call-activities-calling-same-process.bpmn","deploymentId":"b6f32ca3-2dfb-11e6-98d5-08002703433f"},{"id":"b6f32ca6-2dfb-11e6-98d5-08002703433f","name":"pa2/user-task-identity-links.bpmn","deploymentId":"b6f32ca3-2dfb-11e6-98d5-08002703433f"},{"id":"b6f32ca4-2dfb-11e6-98d5-08002703433f","name":"pa2/user-task-without-a-name.bpmn","deploymentId":"b6f32ca3-2dfb-11e6-98d5-08002703433f"}]

“POST /deployment/{id}/redeploy” works well, too.

curl 'http://192.168.43.178:8080/camunda/api/engine/engine/default/deployment/b6f32ca3-2dfb-11e6-98d5-08002703433f/redeploy' \
-H 'Content-Type: application/json' \
-H 'Cookie: JSESSIONID=kjcddrwwo1zo1ejsx4bbmek0u' \
-H 'Connection: keep-alive' \
--data-binary '{"resourceIds":["b6f32ca5-2dfb-11e6-98d5-08002703433f"],"resourceNames":["pa2/sorting-process.bpmn"],"source":"process application"}'

{"links":[{"method":"GET","href":"http://192.168.43.178:8080/camunda/api/engine/engine/default/deployment/fb01babd-2e29-11e6-98d5-08002703433f","rel":"self"}],"id":"fb01babd-2e29-11e6-98d5-08002703433f","name":"second-test-processes","source":"process application","deploymentTime":"2016-06-09T10:07:32","tenantId":null}

But, “POST /deployment/create” doesn’t work.

curl 'http://192.168.43.178:8080/camunda/api/engine/engine/default/deployment/create' \
-H 'Content-Type: application/json' \
-H 'Cookie: JSESSIONID=kjcddrwwo1zo1ejsx4bbmek0u' \
-H 'Connection: keep-alive' \
--data-binary '{"tenant-id":"tenant1","deployment-source":"process application","deployment-name":"sample1","data":"pa2/sorting-process.bpmn"}'

{"type":"MethodNotAllowedException","message":"No resource method found for POST, return 405 with Allow header"}

Of course, “tenant1” exists.

curl 'http://192.168.43.178:8080/camunda/api/engine/engine/default/tenant/tenant1' \
-H 'Content-Type: application/json' \
-H 'Cookie: JSESSIONID=kjcddrwwo1zo1ejsx4bbmek0u' \
-H 'Connection: keep-alive'

{"id":"tenant1","name":"tenant1"}

Thank you in advance.
Masaaki Inaba

Hi Masaaki,

Actually the error message is quite right, because the “POST /deployment/create” endpoint requires a multipart form upload. It doesn’t expect the content-type “application/json”, you are sending.

Could you please try following request, which should be working.

-H 'Cookie: JSESSIONID=kjcddrwwo1zo1ejsx4bbmek0u' \
-H 'Connection: keep-alive' \
-F "data=@myprocessfilelocally;tenant-id=1;deployment-source=process-application;deployment-name=sample1" http://192.168.43.178:8080/camunda/api/engine/engine/default/deployment/create```

Cheers,
Christian

Hi Christian,

Due to your advice, this problem was resolved.
Thank you so much!

Masaaki Inaba