文件类型转换
更新时间:2026-04-14
POST
https://qianfan.baidubce.com/v2/app/files/convertFileType/post
该接口用于转换文件格式。
权限说明
调用本文API,需使用API Key鉴权方式。使用API Key鉴权调用API流程,具体调用流程,请查看认证鉴权。
请求参数
Headers 参数
除公共头域外,无其它特殊头域
Body 参数
url
string
文件URL。
必选
file_name
string
文件名。
必选
origin_type
string
原文件格式,支持的格式类型:
markdown格式转docxhtml格式转pdf
必选
target_type
string
目标文件格式。
必选
请求结构
POST /v2/app/files/convertFileType/post HTTP/1.1
HOST: qianfan.baidubce.com
Authorization: Bearer <API Key>
Content-Type: application/json
{
"url": "http://xxxx.xxx/xxx/test.md",
"file_name": "test.md",
"origin_type": "md",
"target_type": "docx"
}
示例代码
基础调用
curl -X POST "https://qianfan.baidubce.com/v2/app/files/convertFileType/post" \
-H "Authorization: Bearer bce-v3/ALTAK-******ZftZDTn7/125eeb1c5e9ddc8cf3edf18ef6d03f1517ec9408" \
-H "Content-Type: application/json" \
-d '{
"url": "http://xxxx.xxx/xxx/test.md",
"file_name": "test.md",
"origin_type": "md",
"target_type": "docx"
}'
返回响应
Headers 参数
除公共头域外,无其它特殊头域
返回参数
code
string
响应状态码。
可选
message
string
响应消息。
可选
request_id
string
请求ID。
可选
result
object {1}
转换结果信息。
可选
显示子属性
隐藏子属性
download_url
string
文件下载地址。
可选
json
{
"code": "success",
"message": "",
"request_id": "4c3b9f92-****-42f6-8372-06ac97e40dc1",
"result": {
"download_url": "http://xxxx.xxx/xxx/a.docx"
}
}
评价此篇文章
