The BPM document store accepts uploads through the classic REST API as a multipart request; the document is attached to a process instance (or stays unattached) and can carry properties:
# upload (multipart/form-data): file part + metadata as query parameters
curl -k -u user:pw -H "BPMCSRFToken: $TOKEN" \
-F "file=@invoice.pdf;type=application/pdf" \
"https://host:9443/rest/bpm/wle/v1/document?name=invoice.pdf&processInstanceId=2072.123&documentType=INVOICE&properties=%7B%22vendor%22%3A%22Acme%22%7D"
# response: { "data": { "id": "2074.987", "name": "invoice.pdf", "mimeType": "application/pdf", "size": 12345, "url": "/rest/bpm/wle/v1/document/2074.987/content" } }
# download
GET /rest/bpm/wle/v1/document/2074.987/content
# list the documents of an instance
GET /rest/bpm/wle/v1/process/2072.123?parts=documents
# update content (new version) / delete
POST /rest/bpm/wle/v1/document/2074.987?action=update (multipart file) DELETE /rest/bpm/wle/v1/document/2074.987// browser (coach view): upload a File object from an <input type=file> to the current instance
var fd = new FormData(); fd.append("file", input.files[0]);
var xhr = new XMLHttpRequest();
xhr.open("POST", base + "/rest/bpm/wle/v1/document?name=" + encodeURIComponent(input.files[0].name) + "&processInstanceId=" + piid, true);
xhr.setRequestHeader("BPMCSRFToken", token);
xhr.onload = function () { if (xhr.status === 200) ${DocList}.refresh(); };
xhr.send(fd);Notes: parameter names vary slightly by release (processInstanceId vs parentId on 8.5.0; check the REST API tester /bpmrest-ui of your level), the document store must be enabled (it is by default), size limits come from the web container's maximum post size (raise it for large files), and for ECM (FileNet) the equivalent is the CMIS AtomPub / browser binding of the content server, not the BPM document resource. In service flows use tw.system.createDocument instead of REST (question 104).
References