Rest API: create process with item

cancel
Showing results for 
Search instead for 
Did you mean: 
EricLemanissie
Member II

Rest API: create process with item

Hello,

I am currently trying to create a process by using the REST API : HTTP POST request at /alfresco/api/-default-/public/workflow/versions/1/processes with the following data:

{
"processDefinitionKey": "mbWfAddContent",
"variables": {
    "bpm_assignee": "...",
    "bpm_sendEMailNotifications": true,
    "bpm_workflowPriority": 0,
    "mbwf_contentType": "Recording"
}
but it fails with error 500 and this message "Incorrect number of document attached to this workflow. Only one document is accepted". This is because the workflow's startEvent script has
if(bpm_package.children.length == 1)
    .....
else
throw new Error("Incorrect number of document attached to this workflow. Only one document is accepted");
Is there a way to add items to a process directly in the process creation request ?
I cannot use the POST request to ​alfresco/api/-default-/public/workflow/versions/1//processes​/{processId}​/items because the process does not exist yet at this point, so it does not have an id yet.
 
Thanks !