Page 1 of 1

Workflow using Rest API

Posted: Wed Aug 07, 2019 6:02 am
by Vysakh
Can we create flows using rest API, without accessing Design Tab ?

Re: Workflow using Rest API

Posted: Wed Aug 07, 2019 4:31 pm
by amosbatto
There is no easy way to do it with the current REST endpoints. You can use REST to import a process file or create tasks, but there aren't REST endpoint to create the other elements and connect them in a process.

Do you have a special requirement?

Re: Workflow using Rest API

Posted: Wed Aug 07, 2019 5:14 pm
by amosbatto
If you install my extraRest plugin, then you can use GET http://{domain-or-ip}/api/1.0/{workspace}/extrarest/session-id to obtain the session ID and append it to the following URL to open the process designer in an external page:
http://{domain-or-ip}/sys{workspace}/en/neoclassic/designer?prj_uid={process-id}&sid={session-id}

If you want to embed the Process Designer in an external web page, then you can use an <iframe> to open the above URL.

This PHP code worked for me to redirect to the Process Designer for editing a process:
Code: Select all
function redirectToDesigner($oToken) {
	global $pmServer, $pmWorkspace;
	$processId = '3488462315d48989d598bc8012454964';
	
	$url = "$pmServer/api/1.0/$pmWorkspace/extrarest/session-id";
	$oRet = pmRestRequest('GET', $url, null, $oToken->access_token);
	
	if ($oRet->status==200) {
		$redirectUrl = "http://localhost:3310/sysworkflow/en/neoclassic/designer?prj_uid=$processId&sid=" .
			$oRet->response;
		header("location: $redirectUrl");
	}
}