Looking for some examples on using REST API for workflows

Hello,

We are currently doing a POC on using Content Server 16.2.3 REST API for Workflows for below scenarios:
• Initiate workflows using Alpaca forms
• Upload docs before we initiate workflows
• Show form data in Alapaca forms
• Complete workflow task
• Integrating user picker/widget on the alpaca forms to set user fields.

Wondering if anyone out there researching on above topics.
I would really appreciate if you can share any examples.

Thanks,
Mahesh

Tagged:

Comments

  • Initiate workflows using Alpaca forms

    First create a draftprocess, then Intiate it.

    To create draft process

    api/v2/draftprocesses

    Implementation Notes : Creates a draft process

    Model Schema

    DraftProcess { 
      draftprocess_id (integer): The id of the created draft process
    }
    
    Parameter   Value   Description Parameter Type  Data Type   
    workflow_id         Workflow id.    form        integer
    
    
    
    HTTP Status Code  Reason
    400               The REST API URL could not be found in the mappings registry  
    400               It is not allowed to execute an action and a custom action  
    401               Authentication Required
    

    api/v2/draftprocesses/{draftprocess_id}

    To update form data, use action : ”formUpdate
    To Initiate workflow , use action : “Initiate”,

    Implementation Notes :Initiates or updates a workflow based on the provided action.

    Parameter           Value       Description                     Parameter Type  Data Type
    draftprocess_id     (empty)     Draft process id.               path            integer
    action              (empty)     Standard action to be executed. form            string
    
    
    HTTP Status Code    Reason
    400                 The REST API URL could not be found in the mappings registry
    400                 It is not allowed to execute an action and a custom action
    401                 Authentication Required
    

    Upload docs before we initiate workflows

    api/v1/nodes creating a node

    Implementation Notes :Creates a node. Information on the parameters required for specific subtypes is detailed later in this documentation. Note that the parameters for creating objects in v1 and v2 are identical unless otherwise indicated. See the Implementation Notes for specifying categories and attributes during the create.

    CreateResponse {
    id (integer, optional): The ID of the node which was created
    } 
    
    Parameter               Description                Parameter Type   Data Type
    type                    Subtype of the node          form           integer
    parent_id               Parent node ID               form           integer
    name                    Name of the node             form           string
    description             Description of the node      form           string 
    external_create_date    External create date         form           date 
    external_modify_date    External modify date         form           date 
    external_source         External source              form           string
    external_identity       External identity            form           string 
    external_identity_type  External identity type       form           string
    
    HTTP Status Code    Reason
    400                 The REST API URL could not be found in the mappings registry
    400                 An item with the name '{name}' already exists.
    400                 Could not create a new [node type, e.g. 'Folder']
    400                 Missing required parameter '[parameter name]'
    400                 Sorry, the item you requested could not be accessed. Either it does not exist or you do not    have permission to access it. If you were sent a link to this item, please contact the sender for assistance.
    400                 Subtype {type} not registered
    400                 External source not found
    400                 Error getting identity type id
    401                 Authentication Required
    

    Complete workflow task:

    api/v2/processes/{process_id}/subprocesses/{subprocess_id}/tasks/{task_id}

    Implementation Notes : Sends on a process based on the provided action / custom_action. The provided comment is added to the current task.

    Parameters

    Parameter       Value           Description   Parameter Type    Data Type
    process_id      (empty)         Workflow ID.      path               integer
    subprocess_id   (empty)         Sub workflow ID.  path               integer
    task_id         (empty)         Workflow task ID. path               integer
    Action(EX:SendOn, 
    Delegate,etc)   (empty)         Standard action to be executed. This parameter must not be send with the custom_action parameter.  form  string
    custom_action   (empty)         Custom action (disposition) to be executed. This parameter must not be sent with the action parameter.    form   string
    comment         (empty)         Comment which should be set for the action. form     string
    

    Error Status Codes

    HTTP Status Code    Reason
    400               The REST API URL could not be found in the mappings registry
    400               It is not allowed to execute an action and a custom action
    401               Authentication Required
    

    Show form data in Alapaca forms/Integrating user picker/widget on the alpaca forms to set user fields.:

    If the response is in the below format the alpaca form will automatically get rendered:

    api/v1/forms/processes/tasks/update

    Implementation Notes :Gets the Alpaca forms for displaying a workflow item.

    WorkflowPropertiesFormInfo {
    data (WorkflowPropertiesInfo, optional),
    forms (array[WorkflowFormInfo], optional): The array containing the information on workflow attributes to be displayed. The forms are displayed in the workflow dialog.
    }
    WorkflowPropertiesInfo {
    title (string, optional): Title of the workflow,
    instructions (string, optional): Instructions of the workflow task,
    priority (integer, optional): Priority of the workflow task,
    comments_on (boolean, optional): Flag indicating if comments are enabled for the workflow,
    attachments_on (boolean, optional): Flag indicating if attachments are enabled for the workflow,
    data_packages (array[WorkflowDataPackageInfo], optional): The array containing the information about the defined data packages (comments, attachments, ...),
    actions (array[WorkflowActionInfo], optional): The array containing the information about the standard actions for the workflow task. ( example: SendOn, SendForReview, Delegate),
    custom_actions (array[WorkflowActionInfo], optional): The array containing the information about the custom actions (dispositiions) for the workflow task.,
    message (WorkflowPropertiesMessageInfo, optional),
    member_accept (boolean, optional): Indicates if the step has to be accepted before the user can work with it,
    reply_performer_id (integer, optional): Contains in a subwork case, if available, the performerId of the step before this step. Used for the 'Reply' action in smartUI, but can be set in other cases as well. Is not there when the performerId is not available.
    }
    WorkflowDataPackageInfo {
    type (integer, optional): Type of the data package, normally 1,
    sub_type (integer, optional): Sub type of the data package (attachments = 1, comments = 2, attributes = 3, ...),
    data (object, optional): The structure of the data property depends on the data packages
    }
    WorkflowActionInfo {
    key (string, optional): Key of the action, has to be sent when executing the action,
    label (string, optional): Label of the action
    }
    WorkflowPropertiesMessageInfo {
    performer (integer, optional): Performer that is responsible for the message,
    type (string, optional): The type of the message. Supported types are 'delegate', 'review' and 'review_return',
    text (string, optional): The message text
    }
    WorkflowFormInfo {
    data (object, optional): Dynamic data for the workflow to be displayed,
    options (object, optional): Basic data about the alpaca form,
    schema (object, optional): Properties of the parameters being used for displaying workflow attributes,
    columns (integer, optional): Number of columns for the form, currently supported values: 1 or 2
    } 
    
    
    Parameter               Description         Parameter Type   Data Type
    process_id      The ID of the workflow          query       integer
    subprocess_id   The ID of the sub workflow      query       integer
    task_id         The ID of the task in the workflow  query       integer
    
    suppress_response_codesForces the server to always return a HTTP Response of '200 OK'. The data returned from the call will have an additional integer feature named 'statusCode', which will contain the actual status code (the 'statusCode' feature will be added regardless of whether the REST API call was successful or not). This is an empty parameter, thus no value is required (e.g. ?suppress_response_codes).
    

    Error Status Codes

    400 The REST API URL could not be found in the mappings registry
    400 Argument 'process_id' is required
    400 Argument 'subprocess_id' is required
    400 Argument 'task_id' is required
    400 Invalid datatype specified for argument 'process_id'
    400 Invalid datatype specified for argument 'subprocess_id'
    400 Invalid datatype specified for argument 'task_id'
    401 Authentication Required
    500 Could not get a workflow for {process_id}, {subprocess_id}, {task_id}
    
  • Hi Jyothi,
    I have below questions:
    1) How can we initiate workflow with form data. you mentioned to use the action as formUpdate but how do we set the form fields.
    2) How can we get the workflow attachment folder id so we can upload docs while we initiate workflow.