Deploy BPMN diagram from ReactJs app

Hello,
I have created a react app where i have integrated the bpmn-js modeler. i can model my diagrams and now i want to deploy them. I think that i can communicate with the bpmn engine via REST API but i am new to this and i don’t quite understand how to do this. If anyone has some ideas about how to use rest api please share.

In case anyone is interested i just created this class. The data is just the xml file that i got from modeler.saveXML.

export class RestClient {
    constructor(host = 'localhost', port = '8080', endpoint = 'engine-rest') {
        this.host = host;
        this.port = port;
        this.endpoint = endpoint;
    }

    async createDeployment(name, tenantID, data) {
        const form = new FormData();
        form.append('tenant-id', ((!tenantID.trim()) ? '' : tenantID));
        form.append('deployment-source', '');
        form.append('deploy-changed-only', 'false');
        form.append('enable-duplicate-filtering', 'false');
        form.append('deployment-name', name);
        form.append('deployment-activation-time', '');
        form.append('data', new File([data], (name + '.bpmn')));

        const response = await fetch(`http://${this.host}:${this.port}/${this.endpoint}/deployment/create`, {
            method: 'POST',
            headers: {
                'accept': 'application/json'
            },
            body: form
        });

        return response;
    }
}

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