Demos
Run a process with files via Call API
12min
at the bottom of this article you'll be able to find import file containing this ready to use, use case following the import, credentials will need to be configured in order to run a process that uses files as input, 3 api calls must be set up publish flow, upload file, and launch flow step 1 create a process that requires a file input with a file variable called inputfile step 2 then create a new process that will run the first process imputs & outputs \[i] file a file type variable that contains the file for the procees that needs to be started \[i] workspace id the workspace id of the workspace where the process that needs to be started is \[i] inputfile the same type of variable and name with the one from the first process \[i] api key the api key created in the workspace where the process that needs to be started is \[i] flowtemplateid a guid variable that stores the uid of the process you want to start \[i] api key value the api key value created in the workspace where the process that needs to be started is \[o] publishresultbody json variable that stores the body output for the publish flow call api \[o] publishstatus string variable that stores the status output for the publish flow call api \[o] fiieid guid variable that stores the result of the json mapper extract file variable id \[o] uploadfilestatus string variable that stores the upload file call api status \[o] uploadfilerespone json variable that stores the body output for the upload file call api \[o] extraction json variable that stores the result for the json mapper map extraction \[o] error string variable that stores the result for the json mapper map error step 3 in the automation section api keys create a new key https //docs procesio com/api keys https //docs procesio com/api keys step 4 configure the first call api action call api publish flow configuration a post on https //webapi procesio app/api/projects/{flowtemplateid}/instance/publish headers key value workspaceid the workspace id key the api key value the api key value workspace id of the workspace where the process that needs to be started is api key and value from the workspace where the process that needs to be started is body in the body send the file id and name in order to get the file id open the developer tools in your browser open the project you want to run open the networking section select the first response since you opened the process by name identify the file that needs to be upload and copy the id step 5 configure the json mapper to extract the file id json mapper extract file var id input json publishresultbody query $ variables\[?(@ name == 'inputfile')] defaultvalue id result fileid json mapper extract file instance id input json publishresultbody query $ id result flowinstanceid step 6 configure the second call api action call api upload file a post on https //webapi procesio app/api/file/upload/flow headers key value fileid fileid flowtemplateid flowtemplateid flowinstanceid flowinstanceid workspaceid the id of the workspace key the api key value the api key value variablename inputfile body form data key package value value file (the file type variable configured for the process that needs to be started step 7 configure the third call api action call api launch flow query params key value runsynchronous true secondstimeout 300 runsynchronous is required only if a response from the process is expected headers key value key api key value api key value workspaceid the workspace id body { "flowtemplateid" "<%flowtemplateid%>" } step 8 configure the json mapper to get a variable value from the process json mapper map extraction input json launchresponse query $ variable extraction result extraction step 9 configure the json mapper to get the error variable from the process json mapper map error input json launchresponse qury $ variable error result error import file https //archbee doc uploads s3 amazonaws com/pd o7nzlwdisbwglsha9q/7nvvpdwsqowyitywep7m1 runanotherprocess procesio