Deploy XML using "camunda-bpm-sdk-js"!

is it possible to use the camunda create REST API without having an actual file on the pcor the server?
Screenshot%20from%202020-01-28%2014-33-43
I’m trying to add a deploy button in my bpmn-js modeler and read the XML and deploy it as in this example:

deploymentService         = new camClient.resource('deployment');
    bpmnModeler.saveXML({ format: true }, function(err, xml) {
      console.log('DIAGRAM:1', xml);
      var file = new File(xml,'fromWebApp.1312.bpmn');
      var depData = {
        deploymentName: targetengime,
        deploymentSource: 'interactive editor',
        enableDuplicateFiltering: true,
        deployChangedOnly: true,
        tenantId: '',
        files: [file]//<<< HOW TO FILL THE FILE!!
      };
      var callback = function(var1,var2){
        console.log(var1);      
        console.log(var2);      
      };
      deploymentService.create(depData,callback)
    });

but I’m getting this error:
Screenshot%20from%202020-01-28%2014-35-34
so how can i fill the xml as file here!!!

You can also do that via a Blob:

const blob = new Blob([ xml ], { type: 'text/xml' });
1 Like

Thanks Niklas for your reply. I already tried that before posting my qestion and it’s the same error.

You can have a look at the Camunda Modeler deployment service, were it is solved via form data.

1 Like