API 文档¶
概述¶
- 基础URL:
https://api.example.com/v1 - 数据格式: JSON
- 认证方式: Bearer Token (JWT)
认证¶
获取Access Token¶
POST /auth/token
Content-Type: application/json
{
"api_key": "your_api_key",
"api_secret": "your_api_secret"
}
响应示例:
{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "Bearer",
"expires_in": 3600
}
通用说明¶
请求头¶
| 头信息 | 说明 |
|---|---|
| Authorization | Bearer令牌 |
| Content-Type | application/json |
| X-Request-ID | 请求唯一标识 |
响应格式¶
{
"code": 0,
"message": "success",
"data": { ... },
"request_id": "uuid"
}
错误码¶
| 错误码 | 说明 |
|---|---|
| 0 | 成功 |
| 10001 | 参数错误 |
| 10002 | 认证失败 |
| 10003 | 权限不足 |
| 10004 | 资源不存在 |
| 50000 | 服务器错误 |
文档处理 API¶
上传文档¶
POST /document/upload
Authorization: Bearer <token>
Content-Type: multipart/form-data
file: (binary)
响应:
{
"code": 0,
"data": {
"document_id": "doc_xxx",
"filename": "document.pdf",
"page_count": 5,
"status": "processing"
}
}
获取处理结果¶
GET /document/{document_id}/result
Authorization: Bearer <token>
响应:
{
"code": 0,
"data": {
"status": "completed",
"result": {
"text": "提取的文本...",
"tables": [...],
"confidence": 0.98
}
}
}
流程引擎 API¶
创建工作流¶
POST /workflow
Authorization: Bearer <token>
{
"name": "示例流程",
"tasks": [
{"id": "task1", "name": "任务1", "type": "script"},
{"id": "task2", "name": "任务2", "type": "http"}
]
}
执行工作流¶
POST /workflow/{workflow_id}/execute
Authorization: Bearer <token>
{
"input": {"key": "value"},
"async": true
}
智能客服 API¶
发送消息¶
POST /chatbot/message
Authorization: Bearer <token>
{
"session_id": "sess_xxx",
"user_id": "user_xxx",
"message": "您好"
}
响应:
{
"code": 0,
"data": {
"response": "您好,有什么可以帮您?",
"intents": ["闲聊"],
"confidence": 0.95
}
}
SDK下载¶
| 语言 | 安装命令 |
|---|---|
| Python | pip install product-sdk |
| Java | Maven: com.example:product-sdk:1.0 |
| Go | go get github.com/example/product-sdk |
| Node.js | npm install product-sdk |
:material-arrow-right-circle: 集成指南{: .md-button }