> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# flowExecute

> メッセージをTrigger コネクタからTerminal コネクタまでのフロー全体を通して処理します。Flow API の呼び出しと同等であり、管理API ユーザーとauthtoken を介して呼び出す必要があります。

[Flow API](../../flows/flow-api) と同じ方法でフローを処理します。これは、単一のメッセージが連続した1つのプロセスとして複数のコネクタを通して処理されることを意味します。Trigger コネクタで始まりTerminal コネクタで終わるフロー全体を呼び出すことができます。

このオペレーションは、`connector.rsc/flowexecute` エンドポイントで管理API ユーザーとauthtoken を使用して呼び出す必要があります。

## 必要なパラメータ

* **connectorId**：フロー内の最初のコネクタのId。

## オプションのパラメータ

* **WorkspaceId**：フローが配置されているワークスペースのId。指定しない場合、オペレーションはDefault ワークスペースを使用します。
* **MessageData**：UTF-8 テキストとしての受信メッセージデータ。
* **MessageName**：受信メッセージのファイル名。
* **HeaderName#**：メッセージに含めるメッセージヘッダー名のカンマ区切りのリスト。
* **HeaderValue#**：メッセージに含めるメッセージヘッダー値のカンマ区切りのリスト。
* **InputEncoding**：インプットメッセージデータの形式。**UTF-8**、**BASE64**、および**HEX** が使用可能です。デフォルトはUTF-8 です。
* **OutputEncoding**：アウトプットメッセージデータの形式。**UTF-8**、**BASE64**、および**HEX** が使用可能です。デフォルトはUTF-8 です。

## アウトプットパラメータ

* **Result**：結果。**Success**、**Error**、**Warning**、**Pending**、および**Skipped** が使用可能です。
* **MessageData**：**Result** がError、Pending、またはSkipped でない場合の、UTF-8 としてのアウトプットメッセージデータ。
* **MessageName**：アウトプットメッセージのファイル名。
* **ErrorMessage**：**Result** がError またはWarning の場合の詳細なエラーメッセージ。
* **LastConnectorId**：フロー内の最後のコネクタのId。
* **LastWorkspaceId**：フロー内の最後のワークスペースのId。
* **MessageId**：メッセージId。

## 例

この例は、[Script コネクタ](../../connectors/script)（トリガーコネクタ）でこのオペレーションに利用できるインプットとアウトプットを示しています。コネクタId と、コネクタが見つかるワークスペースを指定することで、フロー内の最初のコネクタを定義します。また、フローを通して処理されるファイルのファイル名とその内容も定義します。最後に、`flowExecute` オペレーションが、`connector.rsc/flowexecute` エンドポイントで管理API ユーザーとauthtoken を使用して呼び出されます。

```xml theme={null}
<!--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>  
```
