外观
文件下载
接口概述
根据文件路径下载文件(报告、图纸、压缩包等)。接口直接返回文件流,不返回 JSON 结构。
请求地址
http
GET /downLoadFile?filePath={filePath}请求头
| 参数 | 必填 | 说明 |
|---|---|---|
| apiKey | 是 | API 访问凭证 |
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| filePath | String | 是 | 文件路径,来自上传接口或报告接口返回的地址 |
请求示例
bash
curl -X GET "https://openapi.bangtu-ai.com/openApi/downLoadFile?filePath=openApi/report/xxx.docx" \
-H "apiKey: YOUR_API_KEY" \
-o report.docx返回结果
成功时返回文件二进制流,响应头包含:
| 响应头 | 说明 |
|---|---|
| Content-Type | 根据扩展名推断:application/zip、application/pdf、application/dwg,其他为 application/octet-stream |
| Content-Disposition | attachment;filename*=utf-8''{文件名称} |
| Content-Encoding | 当文件为 .json.gz 时返回 gzip |
下载失败时返回 JSON 错误信息:
json
{
"code": 500,
"message": "文件下载失败",
"data": null,
"timestamp": 1784533680000
}响应码
| code | 说明 |
|---|---|
| 200 | 请求成功,返回文件流 |
| 500 | 下载失败,返回 JSON 错误信息 |
注意事项
filePath必须为有效文件路径,否则下载失败。- 该接口不缓存响应结果(
Cache-Control: no-cache)。