flowExecute

Version 26.1.9515


flowExecute


Processes flows in the same way as the Flow API. This means a single message is processed through multiple connectors as a single consecutive process. Allows you to invoke a full flow that begins with a Trigger connector and ends with a Terminal connector. See Connector Categories for more information.

The operation must be called using an admin API user and authtoken with the connector.rsc/flowexecute endpoint.

Required Parameters

  • connectorId: The Id of the first connector in the flow.

Optional Parameters

  • WorkspaceId: Id of the workspace where the flow is located. If not specified, the operation uses the Default workspace.
  • MessageData: The incoming message data as UTF-8 text.
  • MessageName: The file name of the incoming message.
  • HeaderName#: A comma-separated list of message header names to include on the message.
  • HeaderValue#: A comma-separated list of message header values to include on the message.
  • InputEncoding: The format of the Input message data. Available values are UTF-8, BASE64, and HEX. The default is UTF-8.
  • OutputEncoding: The format of the Output message data. Available values are UTF-8, BASE64, and HEX. The default is UTF-8.

Output Parameters

  • Result: The result. Available values are: Success, Error, Warning, Pending, and Skipped.
  • MessageData: The output message data as UTF-8, if the Result is not Error, Pending, or Skipped.
  • MessageName: The file name of the output message.
  • ErrorMessage: The detailed error message if the Result is Error or Warning.
  • LastConnectorId: The Id of the last connector in the flow.
  • LastWorkspaceId: The Id of the last workspace in the flow.
  • MessageId: The message Id.

Example

This example shows the inputs and the outputs available to this operation in a Script connector (the trigger connector). It defines the first connector in the flow by specifying the connector Id and the workspace where it can be found. It also defines a filename for the file being processed through the flow, as well as its contents. Finally, the flowExecute operation is called using an admin API user and authtoken with the connector.rsc/flowexecute endpoint.

<!--Required:Define first connector in the flow--> 
<arc:set attr="flow.connectorid" value="Script_ChangeName"/> 
<!--Define workspace where flow is located, if not set this uses the Default workspace--> 
<arc:set attr="flow.workspaceid" value="Default"/> 
<!--Set filename of file to pass through flow as messagename attribute--> 
<arc:set attr="flow.messagename" value="[Filename]"/> 
<!--Get contents of message to pass to flow and set as messagedata attribute--> 
<!--Note this loads the contents of the file as a string--> 
<arc:set attr="in.file" value="[Filepath]" /> 
<arc:call op="fileRead" in="in" out="out" > 
  <arc:set attr="flow.messagedata" value="[out.file:data]" /> 
</arc:call> 

<!--Set a header and its value preserving the original filename, to reference later--> 
<arc:set attr="flow.headername#1" value="origfilename"/> 
<arc:set attr="flow.headervalue#1" value="[Filename]"/> 

<!--You must call this operation through connector.rsc and pass in a valid authtoken -->
<arc:call op="connector.rsc/flowExecute" authtoken="test:0d1V7j2r2Z7a9z1Y6z8y" in="flow" out="status"> 
  <!-- This if statement checks if the message encountered an error during processing. If yes, the message is finalized as Error in this script.--> 
  <arc:if exp="[status.result | equals('Error')]" >
    <arc:throw code="FlowFailed" desc="The message failed to be processed by the flowExecute call due to the following error: [status.ErrorMessage | def]" /> 
  </arc:if>
</arc:call>