Using the cURL in a linux command line (bash) is a very convenient and resource efficient way to submit workflows.
We need to login and store the current session id with the command:
sessionid=$(curl --data 'username=admin&password=admin' \ http://localhost:8080/rest/scheduler/login)
One can login with curl using username and password as header parameter, transmitted with -H. The result is written into the sessionid variable. The session id can be displayed with echo $sessionid.
Workflows can be submitted with cURL:
curl --header "sessionid:$sessionid" \
--form \ "file=@filename.xml;type=application/xml" \
http://trydev.activeeon.com:8080/rest/scheduler/submit
The session id variable is inserted into the header and the @ notation allows to send files directly to the server.
Advanced: Workflow Submission with Variables
Workflow variables can be send in the submission URL. Those variables will be replaced.
curl --header "sessionid:$sessionid" \
--form "file=@file.xml;type=application/xml" \
“http://trydev.activeeon.com:8080/rest/scheduler/submit;variable1=test1;variable2=test2”
Important: the URL is now embedded in double quotes "", only then the matrix parameters are properly transferred. Variables are separated by semicolon ;
Important: the URL is now embedded in double quotes "", only then the matrix parameters are properly transferred. Variables are separated by semicolon ;
No comments:
Post a Comment