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" }

接口分类

转换接口

文档格式转换、PDF转换等

查看详情 →

工具接口

PDF处理、图片处理、OCR等

查看详情 →

使用示例

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())

注意事项