Process deployment to REST API through postman

Deploying a model in postman with Content-Type: multipart/form-data returns the following response:

{
    "type": "RestException",
    "message": "multipart/form-data cannot be processed"
}

The request configuration is as follows …

POST : http://localhost:8080/engine-rest/deployment/create

Headers tab:

  • key: Content-Type value: multipart/form-data

Body tab:

  • Form contenty type selected: form-data
  • key (File): file value: [Choose file] (browse .bpmn file)
  • key (Text): deployment-name value: TestDeployment

Postman request:

{
	"variables": [],
	"info": {
		"name": "Camunda",
		"_postman_id": "7198f63a-a9c8-684d-d1a4-ec50443fba02",
		"description": "",
		"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
	},
	"item": [
		{
			"name": "http://localhost:8080/engine-rest/deployment/create",
			"request": {
				"url": "http://localhost:8080/engine-rest/deployment/create",
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "multipart/form-data",
						"description": ""
					}
				],
				"body": {
					"mode": "formdata",
					"formdata": [
						{
							"key": "file",
							"value": "",
							"description": "",
							"type": "file"
						},
						{
							"key": "deployment-name",
							"value": "TestDeployment",
							"description": "",
							"type": "text"
						}
					]
				},
				"description": ""
			},
			"response": []
		}
	]
}

If the variable Content-Type is removed from the Headers the deployment is successful:
Postman request:

{
	"variables": [],
	"info": {
		"name": "Camunda",
		"_postman_id": "7198f63a-a9c8-684d-d1a4-ec50443fba02",
		"description": "",
		"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
	},
	"item": [
		{
			"name": "http://localhost:8080/engine-rest/deployment/create",
			"request": {
				"url": "http://localhost:8080/engine-rest/deployment/create",
				"method": "POST",
				"header": [],
				"body": {
					"mode": "formdata",
					"formdata": [
						{
							"key": "file",
							"value": "",
							"description": "",
							"type": "file"
						},
						{
							"key": "deployment-name",
							"value": "TestDeployment",
							"description": "",
							"type": "text"
						}
					]
				},
				"description": ""
			},
			"response": []
		}
	]
}

response:

{
    "links": [
        {
            "method": "GET",
            "href": "http://localhost:8080/engine-rest/deployment/ffa95ac5-19b3-11e9-a4e9-184f32f2e80b",
            "rel": "self"
        }
    ],
    "id": "ffa95ac5-19b3-11e9-a4e9-184f32f2e80b",
    "name": "TestDeployment",
    "source": null,
    "deploymentTime": "2019-01-16T18:27:29.064+0100",
    "tenantId": null,
    "deployedProcessDefinitions": {
        "ExternalJsExample:5:ffaae167-19b3-11e9-a4e9-184f32f2e80b": {
            "id": "ExternalJsExample:5:ffaae167-19b3-11e9-a4e9-184f32f2e80b",
            "key": "ExternalJsExample",
            "category": "http://bpmn.io/schema/bpmn",
            "description": null,
            "name": "External JS Example",
            "version": 5,
            "resource": "test_deployment.bpmn",
            "deploymentId": "ffa95ac5-19b3-11e9-a4e9-184f32f2e80b",
            "diagram": null,
            "suspended": false,
            "tenantId": null,
            "versionTag": "1.0.0",
            "historyTimeToLive": null,
            "startableInTasklist": true
        }
    },
    "deployedCaseDefinitions": null,
    "deployedDecisionDefinitions": null,
    "deployedDecisionRequirementsDefinitions": null
}

Several posts indicate that the Content-Type should be form-data to do the deployment, is this correct? and if so, why it is not working in postman?

It should be form-data only. Don’t set content-type in headers tab, which is not required. setting form-data in body tab is enough for deployment. Postman is smart enough to fill this header (Content-type) for you. So explicitly setting of content-type not required.

https://developer.esignlive.com/forums/topic/upload-a-new-document-through-multipartform-data-using-postman/

https://developer.esignlive.com/code-share/upload-document-multipartform-data-using-postman/