Files
dify-docs/ja/use-dify/nodes/http-request.mdx
Chenhe Gu 767397a9de changed language codes: cn -> zh, jp -> ja. with other supporting structural changes (#565)
* fix redirect language code prefixes

* rename: cn -> zh, jp -> ja

* remove hardcoded ja / zh references

* remove hardcoded 'english' references

* renamed variable names and dict keys to language agnostic names

* fix: add missing language helper methods to PRAnalyzer

- Add get_language_directory() method
- Initialize source_language and target_languages from config
- Fixes AttributeError when generating mixed PR errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* test: kitchen sink workflow validation v2

This PR validates the translation workflow after config-driven refactoring:

Changes:
- Add new test file: test-workflow-validation.mdx
- Modify existing file: introduction.mdx
- Update docs.json navigation

Tests:
- New file translation (add workflow)
- Existing file translation (update workflow)
- Navigation sync across languages
- Config-driven language codes (zh/ja instead of cn/jp)
- Source language abstraction (no hardcoded "English")

Expected workflow behavior:
1. Detect changes in en/ directory
2. Translate new file to zh and ja
3. Update modified file translations
4. Sync docs.json for all language sections
5. Commit translated files automatically

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: update workflow paths to use zh/ja instead of cn/jp

Aligns workflow trigger paths with the zh/ja language directory rename.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Revert "fix: update workflow paths to use zh/ja instead of cn/jp"

This reverts commit 9587b7cc5d.

* Revert "test: kitchen sink workflow validation v2"

This reverts commit 4abdd69fd2.

* fix: update workflow paths in doc analyze workflow to use zh/ja instead of cn/jp

* Refactor/language codes (#240)

* test: kitchen sink workflow validation v2

This PR validates the translation workflow after config-driven refactoring:

Changes:
- Add new test file: test-workflow-validation.mdx
- Modify existing file: introduction.mdx
- Update docs.json navigation

Tests:
- New file translation (add workflow)
- Existing file translation (update workflow)
- Navigation sync across languages
- Config-driven language codes (zh/ja instead of cn/jp)
- Source language abstraction (no hardcoded "English")

Expected workflow behavior:
1. Detect changes in en/ directory
2. Translate new file to zh and ja
3. Update modified file translations
4. Sync docs.json for all language sections
5. Commit translated files automatically

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: update workflow paths to use zh/ja instead of cn/jp

Aligns workflow trigger paths with the zh/ja language directory rename.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Revert "fix: update workflow paths to use zh/ja instead of cn/jp"

This reverts commit 9587b7cc5d.

* Revert "test: kitchen sink workflow validation v2"

This reverts commit 4abdd69fd2.

* fix: update workflow paths in doc analyze workflow to use zh/ja instead of cn/jp

---------

Co-authored-by: Claude <noreply@anthropic.com>

* fix: update workflow files to use 'source' instead of 'english'

After refactoring the PR analyzer to use 'source' for source language
PRs (instead of hardcoded 'english'), the workflow files need to match.

Changes:
- sync_docs_analyze.yml: pr_type == 'source' (was 'english')
- sync_docs_update.yml: PR_TYPE != 'source' check
- Updated all comments from "English" to "source language"
- Updated all pr_type values in JSON from "english" to "source"

This ensures the workflows trigger correctly with the refactored
config-driven language system.

Related: language code refactoring (cn/jp → zh/ja)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix/workflow source language references (#245)

* test: kitchen sink workflow validation v2

This PR validates the translation workflow after config-driven refactoring:

Changes:
- Add new test file: test-workflow-validation.mdx
- Modify existing file: introduction.mdx
- Update docs.json navigation

Tests:
- New file translation (add workflow)
- Existing file translation (update workflow)
- Navigation sync across languages
- Config-driven language codes (zh/ja instead of cn/jp)
- Source language abstraction (no hardcoded "English")

Expected workflow behavior:
1. Detect changes in en/ directory
2. Translate new file to zh and ja
3. Update modified file translations
4. Sync docs.json for all language sections
5. Commit translated files automatically

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: update workflow paths to use zh/ja instead of cn/jp

Aligns workflow trigger paths with the zh/ja language directory rename.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Revert "fix: update workflow paths to use zh/ja instead of cn/jp"

This reverts commit 9587b7cc5d.

* Revert "test: kitchen sink workflow validation v2"

This reverts commit 4abdd69fd2.

* fix: update workflow paths in doc analyze workflow to use zh/ja instead of cn/jp

* fix: update workflow files to use 'source' instead of 'english'

After refactoring the PR analyzer to use 'source' for source language
PRs (instead of hardcoded 'english'), the workflow files need to match.

Changes:
- sync_docs_analyze.yml: pr_type == 'source' (was 'english')
- sync_docs_update.yml: PR_TYPE != 'source' check
- Updated all comments from "English" to "source language"
- Updated all pr_type values in JSON from "english" to "source"

This ensures the workflows trigger correctly with the refactored
config-driven language system.

Related: language code refactoring (cn/jp → zh/ja)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>

* fix

* fix docs.json language codes

* rename previous version docs: cn -> zh, jp -> ja

* rm duplicate redirect entires

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-28 04:00:02 -08:00

141 lines
8.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "HTTP リクエスト"
description: "外部APIとWebサービスに接続"
icon: "globe"
---
<Note> ⚠️ このドキュメントはAIによって自動翻訳されています。不正確な部分がある場合は、[英語版](/en/use-dify/nodes/http-request)を参照してください。</Note>
HTTP リクエストノードは、ワークフローを外部 API や Web サービスに接続します。データの取得、ウェブフックの送信、ファイルのアップロード、または HTTP リクエストを受け入れる任意のサービスとの統合に使用できます。
<Frame caption="HTTP リクエストノードの設定">
<img src="https://assets-docs.dify.ai/dify-enterprise-mintlify/en/guides/workflow/node/07c5e952eb4c9d6a32d0b7c2d855d4a5.png" alt="HTTP リクエストノードのインターフェース" />
</Frame>
## HTTP メソッド
このノードは、さまざまなタイプの操作に対応する全ての標準 HTTP メソッドをサポートしています:
<Tabs>
<Tab title="データ取得">
**GET** は何も変更せずにサーバーからデータを取得します。ユーザープロファイルの取得、データベースの検索、現在のステータスの取得に使用します。
**HEAD** は完全なレスポンス本文なしでレスポンスヘッダーを取得します。リソースが存在するかどうかの確認やメタデータの取得に便利です。
</Tab>
<Tab title="データ送信">
**POST** はサーバーにデータを送信し、通常は新しいリソースを作成します。フォーム送信、ファイルアップロード、または JSON ペイロードの送信に使用します。
**PUT** はリソースを作成または完全に置き換えます。リソースの全体的な状態を設定したい場合に使用します。
**PATCH** は既存のリソースに部分的な更新を行います。特定のフィールドのみを変更する必要がある場合に使用します。
</Tab>
<Tab title="リソース管理">
**DELETE** はサーバーからリソースを削除します。ファイル、ユーザーアカウント、または削除すべき任意のリソースの削除に使用します。
</Tab>
</Tabs>
## 設定
URL、ヘッダー、クエリパラメータ、リクエスト本文、認証を含む HTTP リクエストのあらゆる側面を設定できます。以前のワークフローノードからの変数は、リクエスト設定のどこにでも動的に挿入できます。
### 変数置換
二重中括弧を使用してワークフロー変数を参照します:`{{variable_name}}`。Dify は深いオブジェクトアクセスをサポートしているため、以前の HTTP レスポンスから `{{api_response.data.items[0].id}}` のようなネストした値を抽出できます。
### タイムアウト設定
HTTP リクエストには、ハングを防ぐための設定可能なタイムアウトがあります:
- **接続タイムアウト**:接続確立の最大時間(デフォルトはデプロイメントによって異なる)
- **読み取りタイムアウト**:レスポンスデータ読み取りの最大時間
- **書き込みタイムアウト**:リクエストデータ送信の最大時間
タイムアウトは、ワークフローのパフォーマンスを維持し、リソースの枯渇を防ぐために適用されます。
### 認証
このノードは複数の認証タイプをサポートしています:
**認証なし**`type: "no-auth"`されません
**API キー**`type: "api-key"`には3つのサブタイプがあります
- **Basic**`type: "basic"`- base64 エンコーディングを使用した Basic Auth ヘッダーを追加
- **Bearer**`type: "bearer"`- `Authorization: Bearer <token>` ヘッダーを追加
- **カスタム**`type: "custom"`- 指定された名前と値でカスタムヘッダーを追加
### リクエスト本文
API 要件に基づいて適切な本文タイプを選択します:
- **JSON** 構造化データ用
- **フォームデータ** 従来の Web フォーム用
- **バイナリ** ファイルアップロード用
- **生テキスト** カスタムコンテンツタイプ用
## ファイル検出
HTTP リクエストノードは、高度なロジックを使用してファイルレスポンスを自動的に検出します:
1. **Content-Disposition 分析** - `attachment` ディスポジションまたはファイル名パラメータをチェック
2. **MIME タイプ評価** - コンテンツタイプを分析してテキストとバイナリを区別
3. **コンテンツサンプリング** - 曖昧なタイプについては、最初の1024バイトをサンプリングしてテキストパターンを検出
テキストベースのレスポンスJSON、XML、HTML など)は通常のデータとして扱われ、バイナリコンテンツはファイル変数になります。
## ファイル操作
HTTP リクエストノードは、ファイルのアップロードとダウンロードをシームレスに処理します:
<Frame caption="ファイルアップロード設定例">
<img src="https://assets-docs.dify.ai/dify-enterprise-mintlify/en/guides/workflow/node/1f2e33cf7bed33096b5aee145006193d.png" alt="HTTP ノードファイルアップロード" />
</Frame>
**ファイルアップロード** はバイナリリクエスト本文オプションを使用します。以前のノードからファイル変数を選択して、文書保存、メディア処理、またはバックアップのために外部サービスにファイルを送信します。
**ファイルダウンロード** は、レスポンスにファイルコンテンツが含まれている場合に自動的に処理されます。ダウンロードされたファイルは、下流のノードで使用するためのファイル変数として利用可能になります。
## エラー処理とリトライ
外部サービスに依存する本番ワークフロー用の堅牢なエラー処理を設定します:
<Frame caption="HTTP リトライ設定">
<img src="https://assets-docs.dify.ai/2024/12/2e7c6080c0875e31a074c2a9a4543797.png" alt="HTTP リトライ設定" />
</Frame>
**リトライ設定** は、設定可能な間隔最大5000msで失敗したリクエストを最大10回まで自動的にリトライします。これは、一時的なネットワークの問題やサービスの利用不能を処理します。
<Frame caption="HTTP エラー処理オプション">
<img src="https://assets-docs.dify.ai/2024/12/91daa86d9770390ab2a41d6d0b6ed1e7.png" alt="HTTP エラー処理" />
</Frame>
**エラー処理** は、HTTP リクエストが失敗した場合の代替ワークフローパスを定義し、外部 API が利用できない場合でもワークフローが実行を継続することを保証します。
## レスポンス処理
HTTP レスポンスは、後続のノードで構造化変数となり、以下への個別アクセスが可能です:
- **レスポンス本文** - API によって返されるメインコンテンツ
- **ステータスコード** - 条件付きロジック用の HTTP ステータス
- **ヘッダー** - キー・値ペアとしてのレスポンスって返される任意のファイルコンテンツ
- **サイズ情報** - 読み取り可能な形式KB/MBでのコンテンツサイズバイト
### SSL 検証
SSL 証明書検証はノードごとに設定可能です(`ssl_verify` パラメータ)。これにより、外部 API のセキュリティを維持しながら、自己署名証明書を使用する内部サービスへの接続が可能になります。
<Frame caption="動的 API 統合ワークフロー例">
<img src="https://assets-docs.dify.ai/dify-enterprise-mintlify/en/guides/workflow/node/090975269f8998f906c5636dde8d9540.png" alt="顧客フィードバック分類ワークフロー" />
</Frame>
## 一般的な統合パターン
**API データ取得** - ユーザープロファイル、製品情報、または外部データを取得して、ワークフロー処理を充実させます。
**ウェブフック配信** - 通知、ステータス更新、または処理結果を外部システムやサービスに送信します。
**ファイル処理** - 分析用の文書をアップロード、さらなる処理用のリソースをダウンロード、またはクラウドストレージサービスとの統合。
**マルチステップ API ワークフロー** - 複数の API 呼び出しを連鎖させ、一つのリクエストからのレスポンスを使用して後続のリクエストを設定します。