Managing workflows
Hi. How can I access via API (php) the workflows from one App?
I saw here: https://developers.podio.com/doc/flows but I don't understand how it works. There isn't an "PodioFlow" in Podio model class.
Someone have an example?
-
Official comment
Hi Patricia,
You are correct, we have not yet added support for workflows in the PHP client. We will put in on our list to get that done.
Meanwhile, you can call the API directly using the request method in the Podio object (https://github.com/podio/podio-php/blob/master/lib/Podio.php).
Comment actions -
Hello Fabricius.
I was trying to create a workflow via the API like you mentioned (with Podio::post()).
I success to create an empty flow who do nothing. But i don't success to create a flow with effect.
I am always getting the following error code "An unexpected error occurred during execution". So i cannot know what i am doing wrong.Can you explain to me how to do it please ?
Maybe i can have an example ?I tried so many ways, i really ned to finish a project.
I need to make a bi-directional synchronisation between two app in different spaces -
Hi Nabil,
Please enable debug mode in the PHP client as described here: http://podio.github.io/podio-php/debug/
Then share request you do to the API along with the error message here. Also share the PHP code that results in the error.
-
Thank you for the fast reply.
The debug mode is activated yet. It is the first function i use wich return that vague error.My function :
Podio::post(
----$url="/flow/app/$MY_APP_ID/",
--------$attributes=[
------------'name'=>'TEST FLOW',
------------'type'=>"item.update",
------------'config'=>['field_ids'=>[$MY_FIELD_ID_TO_EXECUTE_FLOW]],
------------'effects'=>[
------------[
----------------"type"=> "item.update",
----------------"values"=>
-----------------[
---------------------"item.field.EXTERNAL_ID_OF_FIELD_DESTINATION"=>"VALUE_TO_GIVE"
-----------------]
------------]
--------]
----],
----$options=[]
);I also tried :
Podio::post(
----$url="/flow/app/$MY_APP_ID/",
--------$attributes=[
------------'name'=>'TEST FLOW',
------------'type'=>"item.update",
------------'config'=>['field_ids'=>[$MY_FIELD_ID_TO_EXECUTE_FLOW]],
------------'effects'=>[
------------[
----------------"type"=> "item.update",
----------------"values"=>
-----------------[
---------------------ID_OF_FIELD_DESTINATION=>"VALUE_TO_GIVE"
-----------------]
------------]
--------]
----],
----$options=[]
);and
Podio::post(
----$url="/flow/app/$MY_APP_ID/",
--------$attributes=[
------------'name'=>'TEST FLOW',
------------'type'=>"item.update",
------------'config'=>['field_ids'=>[$MY_FIELD_ID_TO_EXECUTE_FLOW]],
------------'effects'=>[
------------[
----------------"type"=> "item.update",
----------------"values"=>
-----------------[]
------------]
--------]
----],
----$options=[]
);Thoses functiun always return taht error.
But when i used :Podio::post(
----$url="/flow/app/$MY_APP_ID/",
--------$attributes=[
------------'name'=>'TEST FLOW',
------------'type'=>"item.update",
------------'config'=>['field_ids'=>[$MY_FIELD_ID_TO_EXECUTE_FLOW]]
--------]
----],
----$options=[]
);
It is working. But it is an empty flows who do nothing. -
And the result i have get :
array(6) { ["error_parameters"]=> array(0) { } ["error_detail"]=> NULL ["error_propagate"]=> bool(false) ["request"]=> array(3) { ["url"]=> string(39) "http://api.podio.com/flow/app/13517330/" ["query_string"]=> string(0) "" ["method"]=> string(4) "POST" } ["error_description"]=> string(44) "An unexpected error occured during execution" ["error"]=> string(10) "unexpected" } -
Nabil,
There should be some kind of request id header in the response you get. I need that to look up the error in the logs. That's why I asked you to enable debug mode. I need to full API request and response, including headers. So far you've only provided code and part of the response.
-
I think it was because i have printed $PodioError->body().
I putted ini_set('display_errors', 1); and Podio::set_debug(true); ine the beginning of the code.I have the following error :
object(PodioServerError)#3 (11) { ["body"]=> array(6) { ["error_parameters"]=> array(0) { } ["error_detail"]=> NULL ["error_propagate"]=> bool(false) ["request"]=> array(3) { ["url"]=> string(39) "http://api.podio.com/flow/app/13528996/" ["query_string"]=> string(0) "" ["method"]=> string(4) "POST" } ["error_description"]=> string(44) "An unexpected error occured during execution" ["error"]=> string(10) "unexpected" } ["status"]=> int(500) ["url"]=> string(19) "/flow/app/13528996/" ["message":protected]=> string(16) "PodioServerError" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(1) ["file":protected]=> string(83) "/Applications/MAMP/htdocs/www/Enerconfort/repo/podio/podio-php-master/lib/Podio.php" ["line":protected]=> int(334) ["trace":"Exception":private]=> array(2) { [0]=> array(6) { ["file"]=> string(83) "/Applications/MAMP/htdocs/www/Enerconfort/repo/podio/podio-php-master/lib/Podio.php" ["line"]=> int(352) ["function"]=> string(7) "request" ["class"]=> string(5) "Podio" ["type"]=> string(2) "::" ["args"]=> array(4) { [0]=> string(4) "POST" [1]=> string(19) "/flow/app/13528996/" [2]=> array(4) { ["name"]=> string(9) "TEST FLOW" ["type"]=> string(11) "item.update" ["config"]=> array(1) { ["field_ids"]=> array(1) { [0]=> int(103588359) } } ["effects"]=> array(1) { [0]=> array(2) { ["type"]=> string(11) "item.update" ["values"]=> array(1) { ["item.field.informations-complementaires"]=> string(11) "hello world" } } } } [3]=> array(0) { } } } [1]=> array(6) { ["file"]=> string(67) "/Applications/MAMP/htdocs/www/Enerconfort/repo/podio/scripttest.php" ["line"]=> int(1035) ["function"]=> string(4) "post" ["class"]=> string(5) "Podio" ["type"]=> string(2) "::" ["args"]=> array(3) { [0]=> string(19) "/flow/app/13528996/" [1]=> array(4) { ["name"]=> string(9) "TEST FLOW" ["type"]=> string(11) "item.update" ["config"]=> array(1) { ["field_ids"]=> array(1) { [0]=> int(103588359) } } ["effects"]=> array(1) { [0]=> array(2) { ["type"]=> string(11) "item.update" ["values"]=> array(1) { ["item.field.informations-complementaires"]=> string(11) "hello world" } } } } [2]=> array(0) { } } } } ["previous":"Exception":private]=> NULL ["request"]=> array(3) { ["url"]=> string(39) "http://api.podio.com/flow/app/13528996/" ["query_string"]=> string(0) "" ["method"]=> string(4) "POST" } }That is enough ?
-
Thank you for the reply.
I have juste checked the php error log with doing again the exception before. I had to put the request outside of the try/catch. I dont think that log can help you to help me :
Stack Trace:
#0 /Applications/MAMP/htdocs/www/Enerconfort/repo/podio/podio-php-master/lib/Podio.php(352): Podio::request('POST', '/flow/app/13528...', Array, Array)
#1 /Applications/MAMP/htdocs/www/Enerconfort/repo/podio/scripttest.php(1370): Podio::post('/flow/app/13528...', Array, Array)
#2 {main}
thrown in /Applications/MAMP/htdocs/www/Enerconfort/repo/podio/podio-php-master/lib/Podio.php on line 334
[21-Sep-2015 12:24:12 Europe/Berlin] PHP Fatal error: Uncaught PodioServerError: "An unexpected error occured during execution"
Request URL: http://api.podio.com/flow/app/13528996/Stack Trace:
#0 /Applications/MAMP/htdocs/www/Enerconfort/repo/podio/podio-php-master/lib/Podio.php(352): Podio::request('POST', '/flow/app/13528...', Array, Array)
#1 /Applications/MAMP/htdocs/www/Enerconfort/repo/podio/scripttest.php(1370): Podio::post('/flow/app/13528...', Array, Array)
#2 {main}
thrown in /Applications/MAMP/htdocs/www/Enerconfort/repo/podio/podio-php-master/lib/Podio.php on line 334I didn't find any ID in that log. Bun t can see a request date.
If it still not enough, please, tell me a way to give you that ID or another information wich can let you to help me.Thank you again to reply me.
Please sign in to leave a comment.
Comments
10 comments