Get html of form of a task via API
I have a human task to which I defined a form through the editor. Is there a way to obtain the html code of such form via the REST API?
Edit: I tried 3 different ways to get the html form throught the API:
I perform the requests after succesfully login through the API, but the first two requests still return the login form. On the other hand the third one seems to return the proper page but the body tag is empty (I imagine the content and the html of the page being generated by various scripts that are not triggered somehow). I also tried to modify the url with various parameters as explained here, but I got nowhere (I think those are not supported anymore in new version of Bonita). What am I doing wrong?
Thanks in advance.
Human task form HTML content is not available using a REST API of Bonita Engine. But it is available using a Bonita Portal URL. URL has the following pattern:
http://localhost:8080/bonita/portal/resource/taskInstance/[process name]/[process version]/[step name]/content/?id=[step instance id]
A documentation page Bonita covers the various Bonita Portal URLs.
I had a Similar situation a while ago. This is how i solved it.
1) Define a Document in your Process.
2) Setup a service task. In the Service task Operation , using BDM object fetch all the Database fields
3) Create a HTML document. Format the HTML to look exactly like the User Form.
4)Insert the BDM values in the HTML document at respective Places.
5) Send the Document as Attachment over email. Reviewers can now download and view the form in HTML format.
6) You can also use the same to save the data as csv values.
7) using connectors wecan convert the HTML to PDF if Required.
Hi and thanks for the answer. Indeed I misswrote; when I said "I tried with the API" I meant "I tried with the Portal URL". After succesffuly login through the API I tried to get the html of the page through a curl request using the URL has explained in the link above. I tried all possible URL (short and long) but got nowhere. My requests looks as follow:
# complete URL
curl -v --location-trusted -i -b saved_cookies.txt --url 'http://localhost:63717/bonita/portal/resource/taskInstance/'"$pName"'/'"$pVer"'/Task/content/?id='"$tId"'' --header "Content-Type: text/html; charset=utf-8" --header 'X-Bonita-API-Token: '"$sId"'' > "test3.html"
# short url
curl -v --location-trusted -i -b saved_cookies.txt --url 'http://localhost:63717/bonita/portal/form/taskInstance/'"$tId"'' --header "Content-Type: text/html; charset=utf-8" --header 'X-Bonita-API-Token: '"$sId"'' > "test1.html"
# alternative request
curl -v --location-trusted -i -b saved_cookies.txt --url ' http://localhost:63717/bonita/portal/form/processInstance/'"$pId"'/task/'"$tName"'' --header "Content-Type: text/html; charset=utf-8" --header 'X-Bonita-API-Token: '"$sId"'' > "test2.html"
tId: task Id;
tName: task name;
pId: process id;
pVer: process version;
pId: process id;
sId: bonita session id;
The first request return the html but the body is empty. The second one returns an nothing while with the 3rd one I get a 404 error.