Hi all,
Is it possible from a PHP to launch a Workflow ?
The PHP's Serveur is installed on the Workflow's Server.
Thanks in advance.
Regards
Hi all,
Is it possible from a PHP to launch a Workflow ?
The PHP's Serveur is installed on the Workflow's Server.
Thanks in advance.
Regards
To follow up on this thread, my team has released a Github repository that shows how to incorporate the Workflow Web Services in different open source languages. Mainly Python, PHP, and some Javascript. Hopefully this helps someone who finds their way on this thread.
https://github.com/CabarrusCo/Laserfiche-Workflow-Web-Services-API-Examples
I do think it is possible, making a POST request using the workflow REST API.
On the workflow machine visit this page to see what URI's to use and JSON body examples
http://localhost/Workflow/api/help
This is how Forms is able to start workflows
Late to the party, just saw this post. Here is a rough example of how to use PHP to POST to workflow web services using cURL. You may have to tweak a bit depending on your organizations setup.
<?php $handle = curl_init(); $url = "http://WORKFLOW-LINK-HERE"; $data = ["ParameterCollection" => [["Name" => "Message", "Value" => "Hello World!"], [ "Name" => "Message Two", "Value" => "Hello World!" ]]]; $data = json_encode($data); curl_setopt_array($handle, array( CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data) ), CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPAUTH => CURLAUTH_NTLM, CURLOPT_USERPWD => "DOMAIN\\ACCOUNT:XXXXX", // STORE ACCOUNT INFO SECURE, NOT PLAINTEXT, EXAMPLE ONLY CURLOPT_RETURNTRANSFER => true ) ); $output = curl_exec($handle); curl_close($handle); echo $output; ?>
Note, this example is only on a test server, when POSTing to https you might have to take extra measures with cURL.
Hi Olivier,
Yes, as Chad mentioned you can do so using the Workflow Web Services API.
Please see my post here for a working example: https://answers.laserfiche.com/questions/168986/Discussion-Will-Laserfiche-ever-get-a-unified-RESTful-HTTP-API#169285
Hi Chad,
Thanks for your help.
I tried to understand your solution but unsuccesful.
Do you have an exemple?
Please see my other response on this thread. It contains a link to a post with a working example for Workflow Web Services attached.
Yes sorry Samuel.
I downloaded your files and try to understand how to use them.
I have 2 WF (Invoking and Invoked). To my mind, I'm using the "Invoking" to invoke the "Invoked" right? But this means I need to run the Workflow "Invoking" from Workflow Designer. I don't understand how to run it from Web.
Hi Olivier
The workflow API uses something now called "REST API" which means a PHP site (or maybe in LF's case .Net site) that sits and listens for HTTP Post Requests.
This site provides the URL's which you will POST to
http://localhost/Workflow/api/help
As far as making a POST, this is something you must do using a method like posted here
https://stackoverflow.com/questions/5647461/how-do-i-send-a-post-request-with-php
The "Invoking" workflow has a Web Request HTTP POST activity that sends a JSON message to the Workflow Web Services endpoint. It is meant to simulate any service that can send HTTP POST requests, since that is a standard protocol supported by most languages and applications. As Chad said there, you would send a similar HTTP POST request using PHP's method(s).