Initiate Workflow from REST



  • @Chris Meyer's post is probably some of the best documentation on this so far. I'm composing a Postman collection based on it, and can possibly upload it somewhere later.


  • Clarke
    edited February 23, 2022 #33

    Hello Hugh,

    For completeness, here is another Gem for Workflow and REST

    Say for example you want to upload a Document into the WF Attachment Volume before you start it.

    How do you get the volume AttachmentID of a draft???

    Well here is the answer in C#:

           public long GetWorkflowDraftAttachmentVolumeID(string ticket, string ticketType, long draftProcessID)
               long result = 0;
               var client = new RestClient(this.ContentServerURL);
               var request = new RestRequest("/api/v1/forms/draftprocesses/update?draftprocess_id=" + draftProcessID, Method.GET);
               request.AddHeader(ticketType, ticket);
               IRestResponse response = client.Execute(request);
               if (response.IsSuccessful == false)
                   throw new Exception("GetWorkflowDraftAttachmentVolumeID REST Call Failed: StatusCode:" + response.StatusCode + " ErrorMessage:" + response.ErrorMessage);
               dynamic json = JObject.Parse(response.Content.ToString());
               result =[0].data.attachment_folder_id;
               return result;

    I pieced this together from the clues, a lot from Matthew's post:



    I have ALL the examples if anybody needs them.

  • Hello @Chris Meyer

    Thank you so much for your input on this topic. I tried to follow your instructions in order to initiate a WF with WF Attributes already completed, but we got into some issues.

    We created a Draft Process, got the Draft Process ID, and wanted to use the formUpdateaction on it, but, as described in this thread by me:

    We are getting the "Could not retrieve action" error... apparently we get this error when we try to use the Initiate action, and we also get this error when we left draftprocess_id empty. We are using Postman for our tests at the moment and the WF Attribute is in a Form in the Start Step. We tried fiddling around with the request data and how we make our request but we get the same error.

    Do we need to make other Content Server configurations beforehand? Any kind of feedback or hint would be greatly appreciated! Thank you

  • Appu Nair
    edited March 30, 2022 #36

    WF Attribute is in a Form  do you mean that you have a Form Template Object out of which a Form was made then you have associated your WF Map to the Form and the Form to the WF? or are you saying that your attribute was made using the function "Workflow Attributes" (Nothing to do with Form template or Form).It makes a **** of a difference as WF stores at index 3 WFAttributes and at Index 4 Forms so the forum readers would like to know.

  • @Appu Nair Our attributes are Workflow Map Attributes, created in the CS Interface from the menu Map -> Attributes, those are the ones I want to have completed before I initiate the WF.


    We recently tried to move this procedure from Postman to Javascript code, and it works (not much has changed from what we did in Postman). We can create a draft process, get that ID, update the values in the draft process, then initiate the draft, as described by Chris. To forum readers, I highly recommend writing code for procedures that need more than 1 request instead of using Postman.

    We did this on a simple WF, that has a WF Attribute called "email", we make a draft process on this, get the draftprocess ID, update the draftprocess by adding a value for the email attribute, then initiate it. This WF then uses the value from the attribute in an Email step to send an automatic email.

  • Appu Nair
    edited March 30, 2022 #38

    I was able to do this 16.2.8 by doing this in Postman.

    Call #1 =POST Content-Disposition: form-data; name="body"
    {"workflow_id": 2047628 }
    Call#2 =PUT Content-Disposition: form-data; name="body"
    	"draftprocess_id": 2124973,
    	"action": "formupdate",
    	"Values": {
    		"WorkflowForm_2": "appu"
    Call#3 PUTContent-Disposition: form-data; name="body"
    {"draftprocess_id": 2124973,"action":"initiate"} 

    I understand this is how OT coded

    1. Tell the System to Generate a draft using the MAPID
    2. Using that draft Prepare the WF Map things like attachments & wf attributes
    3. Finally issue the initiate command.

    Still I am not sure if you have an error or not? the place holder WorkflowForm_2 would theroretically
     equate to email in yours if that was the first attribute added but if there are 
    more I frankly dont know if the mapping is missing

    I take umbrage in using POSTMAN not being useful, I am a programmer who finds it very useful. More than likely what I do is I use POSTMAN understand it and then convert to JS or Java or C# or whatever .The SmartUI and Developer Tools and Fiddler also has been very useful for me. Can you install Fiddler and see if the payload you get in smartui equates to what you are doing?

    I can share my Postman collection here if it is useful after trimming the server info. There were 3 distinct calls to do this WF initiate not counting getting the authtoken.

  • Appu Nair
    edited March 30, 2022 #39

    An addendum to what I posted

    I had a WF attribute called NEEDED when I started my experiment and it was getting set as WorkflowForm_2

    I went to my map deleted the attribute and re-added it now it is being referred internally as WorkflowForm_3

    If you do an export of your map as a UTF8 file there is a function button on the map for that

    you will see an assoc


    so check in your REST PUT code if you have a WorkflowForm_2 or something with a different ID

    BTW this is how most OT code works if you delete an attribute the assigned number of the previous does not get used again.

    "WF REST API EXPERIMENTS.docx" can be accessed via

    the following link:

    "WF REST API EXPERIMENTS.docx" can be accessed via

    the following link:


    it has the postman collection and some introductory screen caps for someone who wants to try this.

  • @Appu Nair Thank you for the information, we experienced this behaviour with the Workflow Forms first hand when trying to update some draft processes.

    It is good to know that you can get this information when exporting the map. We also saw the Workflow Form configuration when we got WF Info on a draft process created for a Worflow.

  • No worries I have been working with OT categories and attributes from version 8.1.5 onwards ,the cats/atts framework and the cryptic numbers the 2,3 and so on is basically generated on the fly so since the WF Smart mechanism seems to use that in lieu of names is very much asking for trouble in my opinion as unknowingly people will delete a WF attribute and add it back then and then wonder why it is not working :) so thought of mentioning that .Even Steps in WF have the same problem so when you progress from a DEV->QA->Prod it is better to transport your artifacts so the code you tested will still work in those higher systems.

  • Hi @AppuNair , We are looking to fetch the attribute values of a workflow from restapi with the workflow id, able to retrieve the Attribute name via api/v2/workflows/status/processes/{workflowid} but not able to retrieve the values

  • appuq

    @bharath_partha1 if you open a workflow in SmartView(note the intonation here is are you seeing all aspects of Workflow in smart, if at any point the interface changes to classic then this test is not valid) see if that information is provided by the smartview widgets. If it is, chances are then a RESTAPI is involved. Very few commands in smartui is implemented as Request handlers(RH's) or the old way, most smartui is executed as RESTAPI ,that is how I figured out most of the workflow code I published in the word documents