> For the complete documentation index, see [llms.txt](https://docs-embed.anyflow.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-embed.anyflow.jp/solution-editor/triggers/outgoing/request-triggers/response-step.md).

# Responseステップ

## **概要**

Responseステップは、トリガーに[Requestトリガー](/solution-editor/triggers/outgoing/request-triggers.md)を選択した場合のみ使用できます。

RequestトリガーはソリューションをAPIリクエストにより実行することができるトリガーですが、\
Responseステップを使用すると、ソリューションの処理で得た値をAPIレスポンスとして返却することができます。

## **設定**

RequestトリガーからResponseステップを呼び出す方法は、[Requestトリガー](/solution-editor/triggers/outgoing/request-triggers.md)のページをご確認ください。

このページでは、Responseステップの詳細な設定について説明します。

### **実行ステータス**

Responseステップより後に配置されたステップは実行されません。\
Responseステップは[停止ステップ](/solution-editor/logic/stop.md)と同様にソリューションの処理は完了にする機能を持っています。

Responseステップの「実行ステータス」の設定では、ソリューションの処理を完了する際、\
ステータスを「成功」として扱うか「失敗」として扱うかを設定することができます。

<figure><img src="https://files.readme.io/0f39b38-image.png" alt=""><figcaption></figcaption></figure>

* 実行ステータス&#x3067;**「成功にする」**&#x3092;選択すると、その実行履歴の状態は成功となります。
* 実行ステータス&#x3067;**「失敗にする」**&#x3092;選択すると、その実行履歴の状態は失敗となります。\
  \&#xNAN;**「メッセージ」**&#x306B;は、停止ステップにより実行失敗となった際に出力するメッセージを指定できます。

詳細は[停止ステップ](/solution-editor/logic/stop.md)のページを確認してください。

### **レスポンス名**

Requestトリガーで設定したレスポンスペイロードのスキーマを呼び出すことができます。

<figure><img src="https://files.readme.io/d706aeb-image.png" alt="" width="563"><figcaption></figcaption></figure>

### **レスポンス ペイロード**

レスポンス名が指定されると、レスポンスペイロードが表示されます。\
任意の値や変数をペイロードに設定することができます。

<figure><img src="https://files.readme.io/e276ec6-image.png" alt=""><figcaption></figcaption></figure>

## Responseステップを複数配置する

Responseステップはソリューションの中で複数配置することが可能です。\
例えば以下のように、ifなどと組み合わせて状況に応じたレスポンスをすることができます。

<figure><img src="/files/eSvHRMxxsSQaoys94yiq" alt="" width="563"><figcaption></figcaption></figure>

Responseステップを直列に複数つなげることも可能ですが、先に処理されたレスポンスが優先され、そこでソリューションは停止します。つまり、以下の図では4番のステップは実行されません。

<figure><img src="https://files.readme.io/d7b03e8-image.png" alt="" width="563"><figcaption></figcaption></figure>

## **注意点**

* ソリューションの実行が5秒以内に終わる場合でも、Responseが返却されるまで少なくとも5秒程度かかります。
* Responseステップで指定した値を返却できるのは、ソリューションの実行が**5分以内で完了する場合のみ**です。
  * 5分以上かかった場合には5分経過時点で下記のようなレスポンスが返却されます。

    ```json
    {
      "message": "HTTP request timed out because Job execution was too long. Job continues to run.",
      "detail": {
        "job": {
          "id": string
        }
      }
    }
    ```
  * ソリューションの組み方によっては実行時間を短縮できる場合があるため、不安な場合はAnyflow CSチームにご連絡ください。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-embed.anyflow.jp/solution-editor/triggers/outgoing/request-triggers/response-step.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
