执行逻辑模型
更新时间:2026-09-24
执行已发布的逻辑模型(Logic API),支持流式与非流式返回。
请求原型
Plain Text
1POST /v2/workspaces/{workspaceId}/logic/api/{logicApiName}/exec
请求头域
| 名称 | 示例值 | 必须 |
|---|---|---|
| X-App-Id | databuilder-logic-service | 是 |
| Authorization | 是 | 鉴权信息,参照以上获取方式 |
请求参数
| 名称 | 类型 | 位置 | 必须 | 说明 |
|---|---|---|---|---|
| inputs | map | body | 是 | 逻辑模型的输入参数 |
| options | Options | body | 否 | 配置参数 |
Options
| 名称 | 类型 | 位置 | 必须 | 说明 |
|---|---|---|---|---|
| stream | Boolean | body | 否 | 接口是否流式返回,默认为true |
| debug | Boolean | body | 否 | 当stream = true时生效,debug为true会返回执行过程,而false则只会返回各步骤的结果 |
响应头域
Content-Type
1、stream = true,Content-Type 为text/event-stream
2、stream = false,Content-Type 为application/json
响应参数名称
| 字段名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 本次 Logic 调用对应的唯一 ID,用于标识一次完整执行过程 |
| sentence_id | int | 是 | SSE 消息序号,从 0 开始递增 |
| is_end | boolean | 是 | 是否为最后一条消息:true 表示流式输出结束 |
| type | string | 是 | 消息类型,用于区分不同阶段或来源的消息 |
| result | string | 是 | 消息内容,具体返回文本信息 |
错误码
| HTTP 状态码 | 含义 | 说明 |
|---|---|---|
| 200 | 成功 | 请求成功 |
| 403 | 无访问权限 | 无操作权限 |
| 404 | 资源不存在 | 逻辑、工作空间不存在 |
| 500 | 系统异常 | 未分类内部错误 |
请求示例
JSON
1curl -X POST \
2 http://bjdd-sys-rpm02rjm9ab.bjdd:8412/v2/workspaces/workspace_aef5_0b4df7aead08/logic/api/test_getMaterialGroupBaseInfo/exec \
3 -H "Content-Type: application/json" \
4 -H "X-App-Id: databuilder-logic-service" \
5 -H "Authorization: xxxxxx" \
6 -d '{
7 "inputs": {
8 "material_no": "M-PCB-0073"
9 },
10 "options": {
11 "stream": false,
12 "debug": false
13 }
14}
响应示例
JSON
1{
2 "id": "47e82a46-3f42-4a3a-9700-346e2ee1b15b",
3 "type": "result",
4 "result": {
5 "main_material_no": {
6 "data": "M-PCB-0073"
7 },
8 "material_group_info": {
9 "data": [
10 {
11 "avlStatus": "Y",
12 "classification": "PCB",
13 "coo": "CN",
14 "createdAt": "2025-11-15T16:06:03.000+08:00",
15 "hasAvailableSource": "Y",
16 "ifCombine": "Y",
17 "inventory": 900,
18 "isDiscontinued": "N",
19 "isDomestic": "Y",
20 "leadTime": 60,
21 "lowFreqSafeStock": 0,
22 "mainMaterialNo": "M-PCB-0073",
23 "materialName": "高亮传感器 专业版",
24 "materialNo": "M-PCB-0073",
25 "modelStage": "光刻",
26 "moiStandard": "1",
27 "owner": "周工",
28 "updatedAt": "2025-11-22T16:06:03.000+08:00",
29 "vendorId": "VENDOR-735",
30 "vendorQuota": 20
31 },
32 {
33 "avlStatus": "Y",
34 "classification": "PCB",
35 "coo": "CN",
36 "createdAt": "2025-10-23T16:06:03.000+08:00",
37 "hasAvailableSource": "Y",
38 "ifCombine": "Y",
39 "inventory": 1000,
40 "isDiscontinued": "N",
41 "isDomestic": "Y",
42 "leadTime": 60,
43 "lowFreqSafeStock": 0,
44 "mainMaterialNo": "M-PCB-0073",
45 "materialName": "高亮传感器 标准版",
46 "materialNo": "M-PCB-0073-ALT1",
47 "modelStage": "光刻",
48 "moiStandard": "1",
49 "owner": "周工",
50 "updatedAt": "2025-11-11T16:06:03.000+08:00",
51 "vendorId": "VENDOR-255",
52 "vendorQuota": 20
53 },
54 {
55 "avlStatus": "Y",
56 "classification": "PCB",
57 "coo": "CN",
58 "createdAt": "2025-05-10T16:06:03.000+08:00",
59 "hasAvailableSource": "Y",
60 "ifCombine": "Y",
61 "inventory": 1000,
62 "isDiscontinued": "N",
63 "isDomestic": "Y",
64 "leadTime": 60,
65 "lowFreqSafeStock": 0,
66 "mainMaterialNo": "M-PCB-0073",
67 "materialName": "高亮传感器 型号",
68 "materialNo": "M-PCB-0073-ALT2",
69 "modelStage": "光刻",
70 "moiStandard": "1",
71 "owner": "周工",
72 "updatedAt": "2025-11-24T16:06:03.000+08:00",
73 "vendorId": "VENDOR-399",
74 "vendorQuota": 60
75 }
76 ]
77 },
78 "origin_material": {
79 "data": {
80 "avlStatus": "Y",
81 "classification": "PCB",
82 "coo": "CN",
83 "createdAt": "2025-11-15T16:06:03.000+08:00",
84 "hasAvailableSource": "Y",
85 "ifCombine": "Y",
86 "inventory": 900,
87 "isDiscontinued": "N",
88 "isDomestic": "Y",
89 "leadTime": 60,
90 "lowFreqSafeStock": 0,
91 "mainMaterialNo": "M-PCB-0073",
92 "materialName": "高亮传感器 专业版",
93 "materialNo": "M-PCB-0073",
94 "modelStage": "光刻",
95 "moiStandard": "1",
96 "owner": "周工",
97 "updatedAt": "2025-11-22T16:06:03.000+08:00",
98 "vendorId": "VENDOR-735",
99 "vendorQuota": 20
100 }
101 },
102 "real_owner": {
103 "data": "M-PCB-0073"
104 }
105 },
106 "sentence_id": 4,
107 "is_end": true
108}
评价此篇文章
