...
| Wiki 标记 |
|---|
h2. 接口名称
下载文件(通过文件Key)(Download File By File Key)
h2. 接口地址
{code}
/api/shipper/v1/file/download
{code}
h2. 请求方式
{code}
POST
{code}
h2. 接口描述
该接口用于通过文件 Key 下载服务器上的文件。主要用于上传订单失败后,下载包含错误信息的 Excel 文件。
h2. 请求头
|| 参数 || 类型 || 必填 || 说明 ||
| sessionId | String | 是 | 登录会话ID |
| language | String | 是 | 语言 |
| Content-Type | String | 是 | application/json;charset=UTF-8 或 application/x-www-form-urlencoded |
*语言取值:*
|| 值 || 说明 ||
| zh_CN | 中文 |
| en_US | 英文 |
h2. 请求参数
**参数通过 URL 查询参数传递:**
|| 参数 || 类型 || 必填 || 说明 ||
| fileKey | String | 是 | 文件唯一标识Key(通常由上传接口返回) |
h2. 参数说明
**fileKey - 文件Key**
- 来源:上传订单接口返回的 `fileId` 字段
- 格式:字符串,如
"abc123xyz"
-
用途:标识服务器上存储的文件
- 时效:文件可能有时效限制
h2. 请求示例
**方式一:application/json方式一:URL 参数 **
{code}
curl 'https://tracking-qa.etowertech.com/api/shipper/v1/file/download' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Content-Type: application/json;charset=UTF-8?fileKey=abc123xyz' \
-H 'language: zh_CN' \
-H 'sessionId: vP1l43F_OqvoTUWBcaAtyg' \
--data-rawO
'{
"fileKey": "abc123xyz"
}'
{code}
**方式二:application/x-www-form-urlencoded**
{code}
curl 'https://tracking-qa.etowertech.com/api/file/download' \
-H 'language: zh_CN' \
-H
'sessionId: vP1l43F_OqvoTUWBcaAtyg' \
--data-urlencode 'fileKey=abc123xyz'
{code}
h2. 返回说明
*响应类型:* application/octet-stream(文件流)
*响应头:*
|| 参数 || 说明 ||
| Content-Disposition | 文件名,如:attachment; filename=failed_orders.xlsx |
| Content-Type | 文件类型 |
| Content-Length | 文件大小 |
*返回说明:*
- 返回的是文件流(Excel 文件)
- 前端会触发浏览器下载文件
- 下载的文件包含上传失败的订单及错误详情
|