API文档
兵卒Office提供本地HTTP JSON API,监听端口 19873,可与外部自动化平台无缝对接。
基础信息
Base URL
http://localhost:19873
所有API请求均为POST方法,请求体为JSON格式。
通用响应格式
{
"success": true,
"message": "操作成功",
"data": { ... },
"outputPath": "输出文件路径"
}
错误响应
{
"success": false,
"error": "错误描述",
"code": "ERROR_CODE"
}
接口分类
使用示例
curl调用
curl -X POST http://localhost:19873/api/convert \
-H "Content-Type: application/json" \
-d '{"input": "document.docx", "output": "document.pdf", "format": "pdf"}'
Python调用
import requests
response = requests.post(
"http://localhost:19873/api/convert",
json={"input": "document.docx", "output": "document.pdf", "format": "pdf"}
)
print(response.json())
注意事项
- API服务仅在兵卒Office运行时可用
- 文件路径支持绝对路径和相对路径
- 所有操作均为本地处理,不上传云端
- 批量操作建议控制并发数量,避免资源耗尽