How to upload or download documents from ongoing Workflow?

Options

Hello everyone,

We're trying to achieve a functionality where we need to extract or add documents to an ongoing workflow. Basically download/upload a Node from the Attachments Folder.

We've experimented with draft processes where we managed to get the ID of the Attachments Folder where we accessed some default documents for that process, but after initiating the WF it seemed that the ID of the Attachments Folder changed.

How could we get the Attachments Folder ID of an ongoing Workflow based on the WF ID, and how could we upload/download files from this Node?

Note: We have to use the Content Server REST API 21.4

Thank you all!

Comments

  • Appu Nair
    edited April 4, 2022 #2
    Options

    The OOB REST API of OT seems to be incomplete however since OT Workflow is very mature its internal relations is very well known so workarounds are possible. I see they offer it in Smartview did you check the calls?

  • Appu Nair
    edited April 4, 2022 #3
    Options

    Assuming you know the Workid/Subworkid and Step # one can issue a call like this

    Workid, Subworkid will always be same unless a subworkflow is generated

    GET /otcs/cs.exe/api/v1/forms/processes/tasks/update?process_id=292516&subprocess_id=292516&task_id=1

    This would give you JSON

    If you add a File by drag and drop the JSON that happens is a ADD ,DELETE and so on.I added a file by DnD

    GET /otcs/cs.exe/api/v1/forms/nodes/create?parent_id=292514&type=144 If you Finalize the pay load by clicking the sendon button it does a PUT

    PUT /otcs/cs.exe/api/v2/processes/292516/subprocesses/292516/tasks/1


    all of the smartui can now be attempted by POSTman or code. I did not get time to try this so i am not sure what the GET command is doing in this process .I had always thought adding files etc. is always by a PUT or a POST.I will try later and see if you can get by the following commands without using the SmartUI.

  • @Appu Nair thank you once again for this valuable information you're a life saver.

    Using the request you presented we were able to extract the ID of the Attachments folder, from here we managed to upload a document using the Create Node method and also see & get documents from this directory.

    ☺️

  • As @Appu Nair states its currently not in the REST API, a Feature Request to OT should be in order and then share the value so others can support it too.

    In terms of how you would do this, you should be able to use a LiveReport / WebReport and provide the WorkID and SubWorkID values and have them return the Node ID of the attachments folder which you can then access using standard REST calls.