| --- | --- | ||||
| <Heading | |||||
| url='/files/:file_id/preview' | |||||
| method='GET' | |||||
| title='File Preview' | |||||
| name='#file-preview' | |||||
| /> | |||||
| <Row> | |||||
| <Col> | |||||
| Preview or download uploaded files. This endpoint allows you to access files that have been previously uploaded via the File Upload API. | |||||
| <i>Files can only be accessed if they belong to messages within the requesting application.</i> | |||||
| ### Path Parameters | |||||
| - `file_id` (string) Required | |||||
| The unique identifier of the file to preview, obtained from the File Upload API response. | |||||
| ### Query Parameters | |||||
| - `as_attachment` (boolean) Optional | |||||
| Whether to force download the file as an attachment. Default is `false` (preview in browser). | |||||
| ### Response | |||||
| Returns the file content with appropriate headers for browser display or download. | |||||
| - `Content-Type` Set based on file mime type | |||||
| - `Content-Length` File size in bytes (if available) | |||||
| - `Content-Disposition` Set to "attachment" if `as_attachment=true` | |||||
| - `Cache-Control` Caching headers for performance | |||||
| - `Accept-Ranges` Set to "bytes" for audio/video files | |||||
| ### Errors | |||||
| - 400, `invalid_param`, abnormal parameter input | |||||
| - 403, `file_access_denied`, file access denied or file does not belong to current application | |||||
| - 404, `file_not_found`, file not found or has been deleted | |||||
| - 500, internal server error | |||||
| </Col> | |||||
| <Col sticky> | |||||
| ### Request Example | |||||
| <CodeGroup | |||||
| title="Request" | |||||
| tag="GET" | |||||
| label="/files/:file_id/preview" | |||||
| targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\ | |||||
| --header 'Authorization: Bearer {api_key}'`} | |||||
| /> | |||||
| ### Download as Attachment | |||||
| <CodeGroup | |||||
| title="Download Request" | |||||
| tag="GET" | |||||
| label="/files/:file_id/preview?as_attachment=true" | |||||
| targetCode={`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`} | |||||
| /> | |||||
| ### Response Headers Example | |||||
| <CodeGroup title="Response Headers"> | |||||
| ```http {{ title: 'Headers - Image Preview' }} | |||||
| Content-Type: image/png | |||||
| Content-Length: 1024 | |||||
| Cache-Control: public, max-age=3600 | |||||
| ``` | |||||
| </CodeGroup> | |||||
| ### Download Response Headers | |||||
| <CodeGroup title="Download Response Headers"> | |||||
| ```http {{ title: 'Headers - File Download' }} | |||||
| Content-Type: image/png | |||||
| Content-Length: 1024 | |||||
| Content-Disposition: attachment; filename*=UTF-8''example.png | |||||
| Cache-Control: public, max-age=3600 | |||||
| ``` | |||||
| </CodeGroup> | |||||
| </Col> | |||||
| </Row> | |||||
| --- | |||||
| <Heading | <Heading | ||||
| url='/workflows/logs' | url='/workflows/logs' | ||||
| method='GET' | method='GET' | 
| --- | --- | ||||
| <Heading | |||||
| url='/files/:file_id/preview' | |||||
| method='GET' | |||||
| title='ファイルプレビュー' | |||||
| name='#file-preview' | |||||
| /> | |||||
| <Row> | |||||
| <Col> | |||||
| アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。 | |||||
| <i>ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。</i> | |||||
| ### パスパラメータ | |||||
| - `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, サーバー内部エラー | |||||
| </Col> | |||||
| <Col sticky> | |||||
| ### リクエスト例 | |||||
| <CodeGroup | |||||
| title="Request" | |||||
| tag="GET" | |||||
| label="/files/:file_id/preview" | |||||
| targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\ | |||||
| --header 'Authorization: Bearer {api_key}'`} | |||||
| /> | |||||
| ### 添付ファイルとしてダウンロード | |||||
| <CodeGroup | |||||
| title="Download Request" | |||||
| tag="GET" | |||||
| label="/files/:file_id/preview?as_attachment=true" | |||||
| targetCode={`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`} | |||||
| /> | |||||
| ### レスポンスヘッダー例 | |||||
| <CodeGroup title="Response Headers"> | |||||
| ```http {{ title: 'ヘッダー - 画像プレビュー' }} | |||||
| Content-Type: image/png | |||||
| Content-Length: 1024 | |||||
| Cache-Control: public, max-age=3600 | |||||
| ``` | |||||
| </CodeGroup> | |||||
| ### ダウンロードレスポンスヘッダー | |||||
| <CodeGroup title="Download Response Headers"> | |||||
| ```http {{ title: 'ヘッダー - ファイルダウンロード' }} | |||||
| Content-Type: image/png | |||||
| Content-Length: 1024 | |||||
| Content-Disposition: attachment; filename*=UTF-8''example.png | |||||
| Cache-Control: public, max-age=3600 | |||||
| ``` | |||||
| </CodeGroup> | |||||
| </Col> | |||||
| </Row> | |||||
| --- | |||||
| <Heading | <Heading | ||||
| url='/workflows/logs' | url='/workflows/logs' | ||||
| method='GET' | method='GET' | 
| </Row> | </Row> | ||||
| --- | --- | ||||
| <Heading | |||||
| url='/files/:file_id/preview' | |||||
| method='GET' | |||||
| title='文件预览' | |||||
| name='#file-preview' | |||||
| /> | |||||
| <Row> | |||||
| <Col> | |||||
| 预览或下载已上传的文件。此端点允许您访问先前通过文件上传 API 上传的文件。 | |||||
| <i>文件只能在属于请求应用程序的消息范围内访问。</i> | |||||
| ### 路径参数 | |||||
| - `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, 服务内部错误 | |||||
| </Col> | |||||
| <Col sticky> | |||||
| ### 请求示例 | |||||
| <CodeGroup | |||||
| title="Request" | |||||
| tag="GET" | |||||
| label="/files/:file_id/preview" | |||||
| targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\ | |||||
| --header 'Authorization: Bearer {api_key}'`} | |||||
| /> | |||||
| ### 作为附件下载 | |||||
| <CodeGroup | |||||
| title="Request" | |||||
| tag="GET" | |||||
| label="/files/:file_id/preview?as_attachment=true" | |||||
| targetCode={`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`} | |||||
| /> | |||||
| ### 响应标头示例 | |||||
| <CodeGroup title="Response Headers"> | |||||
| ```http {{ title: 'Headers - 图片预览' }} | |||||
| Content-Type: image/png | |||||
| Content-Length: 1024 | |||||
| Cache-Control: public, max-age=3600 | |||||
| ``` | |||||
| </CodeGroup> | |||||
| ### 文件下载响应标头 | |||||
| <CodeGroup title="Download Response Headers"> | |||||
| ```http {{ title: 'Headers - 文件下载' }} | |||||
| Content-Type: image/png | |||||
| Content-Length: 1024 | |||||
| Content-Disposition: attachment; filename*=UTF-8''example.png | |||||
| Cache-Control: public, max-age=3600 | |||||
| ``` | |||||
| </CodeGroup> | |||||
| </Col> | |||||
| </Row> | |||||
| --- | |||||
| <Heading | <Heading | ||||
| url='/workflows/logs' | url='/workflows/logs' | ||||
| method='GET' | method='GET' |