Skip to content

文件下载 ​

接口概述 ​

根据文件路径下载文件(报告、图纸、压缩包等)。接口直接返回文件流,不返回 JSON 结构。

请求地址 ​

http
GET /downLoadFile?filePath={filePath}

请求头 ​

参数必填说明
apiKey是API 访问凭证

请求参数 ​

参数类型必填说明
filePathString是文件路径,来自上传接口或报告接口返回的地址

请求示例 ​

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-Dispositionattachment;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)。