> 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;選択すると、その実行履歴の状態は失敗となります。\
  **「メッセージ」**&#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="https://1345286555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2SAP0zfldVFDluPfMXkq%2Fuploads%2F6kqJ2KX1f5olQWN1Dvi7%2Fimage.png?alt=media&amp;token=9de362ae-68ff-441b-8c39-a041a11e4a76" 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チームにご連絡ください。
* Responseステップのログのサイズが[ログ保存の上限値](/ops/step-execution-limit.md)を超えた場合、指定した値は返却されず、ステータスコード400系のエラーが返却されます。


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
