How to create new process deployment using nodejs

I want to create a new process deployment with nodejs. Can you show me source code how to send request like this in postman ? Thank you very much

I like the simplicity of axios:

  • npm install axios form-data
  • node deploy.js

deploy.js

const axios = require('axios');
const fs = require('fs');
const FormData = require('form-data');

(async function() {
  let form = new FormData();
  form.append('deployment-name', 'My Deployment');
  form.append('deployment-source', 'Local Node Test');
  form.append('data', fs.createReadStream('process.bpmn'));

  const options = {
    url: 'http://localhost:8080/engine-rest/deployment/create',
    method: 'POST',
    data: form,
    headers: form.getHeaders()
  };

  try {
    const response = await axios(options);
    console.log(response);
  } catch(err) {
    console.error(err);
  }
}()).catch(e => {
  console.error(e);
});
1 Like

But, how can you run without path of the file ?

If you were to ask that question to 100 people, you’d probably get 100 different answers. What is your requirement? How do you need to provide the file for upload?

I also have a similar requirement where I need to create a workflow that can be used to deploy other workflows, if anyone have an idea or worked on it please do inform me