diff --git a/web/app/components/develop/template/template_advanced_chat.ja.mdx b/web/app/components/develop/template/template_advanced_chat.ja.mdx index 65a9daa19..bbe0f29b7 100644 --- a/web/app/components/develop/template/template_advanced_chat.ja.mdx +++ b/web/app/components/develop/template/template_advanced_chat.ja.mdx @@ -392,6 +392,86 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from --- + + + + アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。 + + ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。 + + ### パスパラメータ + - `file_id` (string) 必須 + プレビューするファイルの一意識別子。ファイルアップロード API レスポンスから取得します。 + + ### クエリパラメータ + - `as_attachment` (boolean) オプション + ファイルを添付ファイルとして強制ダウンロードするかどうか。デフォルトは `false`(ブラウザでプレビュー)。 + + ### レスポンス + ブラウザ表示またはダウンロード用の適切なヘッダー付きでファイル内容を返します。 + - `Content-Type` ファイル MIME タイプに基づいて設定 + - `Content-Length` ファイルサイズ(バイト、利用可能な場合) + - `Content-Disposition` `as_attachment=true` の場合は "attachment" に設定 + - `Cache-Control` パフォーマンス向上のためのキャッシュヘッダー + - `Accept-Ranges` 音声/動画ファイルの場合は "bytes" に設定 + + ### エラー + - 400, `invalid_param`, パラメータ入力異常 + - 403, `file_access_denied`, ファイルアクセス拒否またはファイルが現在のアプリケーションに属していません + - 404, `file_not_found`, ファイルが見つからないか削除されています + - 500, サーバー内部エラー + + + + ### リクエスト例 + + + ```bash {{ title: 'cURL - ブラウザプレビュー' }} + curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ + --header 'Authorization: Bearer {api_key}' + ``` + + + + ### 添付ファイルとしてダウンロード + + + ```bash {{ title: 'cURL' }} + curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ + --header 'Authorization: Bearer {api_key}' \ + --output downloaded_file.png + ``` + + + + ### レスポンスヘッダー例 + + ```http {{ title: 'ヘッダー - 画像プレビュー' }} + Content-Type: image/png + Content-Length: 1024 + Cache-Control: public, max-age=3600 + ``` + + + ### ダウンロードレスポンスヘッダー + + ```http {{ title: 'ヘッダー - ファイルダウンロード' }} + Content-Type: image/png + Content-Length: 1024 + Content-Disposition: attachment; filename*=UTF-8''example.png + Cache-Control: public, max-age=3600 + ``` + + + + +--- + --- - - - - アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。 - - ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。 - - ### パスパラメータ - - `file_id` (string) 必須 - プレビューするファイルの一意識別子。ファイルアップロード API レスポンスから取得します。 - - ### クエリパラメータ - - `as_attachment` (boolean) オプション - ファイルを添付ファイルとして強制ダウンロードするかどうか。デフォルトは `false`(ブラウザでプレビュー)。 - - ### レスポンス - ブラウザ表示またはダウンロード用の適切なヘッダー付きでファイル内容を返します。 - - `Content-Type` ファイル MIME タイプに基づいて設定 - - `Content-Length` ファイルサイズ(バイト、利用可能な場合) - - `Content-Disposition` `as_attachment=true` の場合は "attachment" に設定 - - `Cache-Control` パフォーマンス向上のためのキャッシュヘッダー - - `Accept-Ranges` 音声/動画ファイルの場合は "bytes" に設定 - - ### エラー - - 400, `invalid_param`, パラメータ入力異常 - - 403, `file_access_denied`, ファイルアクセス拒否またはファイルが現在のアプリケーションに属していません - - 404, `file_not_found`, ファイルが見つからないか削除されています - - 500, サーバー内部エラー - - - - ### リクエスト例 - - - ```bash {{ title: 'cURL - ブラウザプレビュー' }} - curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ - --header 'Authorization: Bearer {api_key}' - ``` - - - - ### 添付ファイルとしてダウンロード - - - ```bash {{ title: 'cURL' }} - curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ - --header 'Authorization: Bearer {api_key}' \ - --output downloaded_file.png - ``` - - - - ### レスポンスヘッダー例 - - ```http {{ title: 'ヘッダー - 画像プレビュー' }} - Content-Type: image/png - Content-Length: 1024 - Cache-Control: public, max-age=3600 - ``` - - - ### ダウンロードレスポンスヘッダー - - ```http {{ title: 'ヘッダー - ファイルダウンロード' }} - Content-Type: image/png - Content-Length: 1024 - Content-Disposition: attachment; filename*=UTF-8''example.png - Cache-Control: public, max-age=3600 - ``` - - - - ---- -