获取 Logic API 详情
更新时间:2026-09-24
接口描述
获取指定 Logic 的 API 详情,包括基本信息、编排 blocks 与调用 URL。
权限说明
需具备该 Logic 所在工作空间的查看权限。
注意事项
- workspaceId、logicId 不存在或无权限时,请求会失败。
请求结构
Plain Text
1GET /v2/workspaces/{workspaceId}/logic/{logicId}/api HTTP/1.1
2Host: databuilder.bd.baidubce.com
3X-App-Id: databuilder-logic-service
4Authorization: authorization string
请求头域
| 名称 | 示例值 | 必须 | 描述 |
|---|---|---|---|
| X-App-Id | databuilder-logic-service | 是 | 应用标识,用于后端识别调用方所属业务应用,固定传 databuilder-logic-service |
| Authorization | 是 | 鉴权信息,参照鉴权文档获取 |
请求参数
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| workspaceId | path | string | 是 | 工作空间唯一 ID,Logic 归属的工作空间标识 |
| logicId | path | string | 是 | Logic 唯一标识 ID |
响应头域
Content-Type: application/json
响应参数
| 名称 | 类型 | 说明 |
|---|---|---|
| logicId | string | Logic 的唯一标识 ID |
| name | string | Logic 名称 |
| type | string | Logic 类型,取值 logic、datasearch |
| description | string | Logic 描述 |
| createTime | string | 创建时间 |
| creatorName | string | 创建人 |
| modifyUserName | string | 最后修改人 |
| modifyTime | string | 最后修改时间 |
| apiName | string | API 名称,用于拼接 exec 调用接口路径 |
| blocks | [object] | Logic 的编排块列表,描述其执行流程;块类型包括 input(输入)、use-llm(大模型调用)、function(函数处理)、output(输出)等 |
| url | string | 该 Logic API 的调用地址(exec 接口完整 URL),可直接 POST 请求此地址执行当前 Logic,传入输入参数,拿到编排执行结果 |
错误码
| HTTP 状态码 | 含义 | 说明 |
|---|---|---|
| 200 | 成功 | 请求成功 |
| 403 | 无访问权限 | 无操作权限 |
| 404 | 资源不存在 | 逻辑、工作空间不存在 |
| 500 | 系统异常 | 未分类内部错误 |
请求示例
JSON
1curl -X GET \
2 http://bjdd-sys-rpm02rjm9ab.bjdd:8412/v2/workspaces/workspaceId/logic/logic-0/api \
3 -H "Content-Type: application/json" \
4 -H "X-App-Id: databuilder-logic-service" \
5 -H "Authorization: xxxxxx"
响应示例
JSON
1{
2 "logicId": "163cfd46dd8a4850bf85f93ff9ba6da7",
3 "name": "hg_test_getMaterialGroupBaseInfo",
4 "apiName": "hg_test_getMaterialGroupBaseInfo",
5 "url": "http://bjdd-sys-rpm02rjm9ab.bjdd:8412/v2/workspaces/workspace_aef5_0b4df7aead08/logic/api/hg_test_getMaterialGroupBaseInfo/exec",
6 "blocks": [
7 {
8 "type": "input",
9 "output": [
10 {
11 "type": "string",
12 "description": "物料编号",
13 "variableName": "material_no",
14 "require": false,
15 "defaultValue": ""
16 }
17 ]
18 },
19 {
20 "type": "use-llm",
21 "title": "查询原物料基础信息",
22 "model": "model_svc_8c4f_a0377d123123",
23 "taskPrompt": "请帮我查一下原物料号是 $material_no 的物料详细信息",
24 "systemPrompt": "你是一个智能体,通过提供的实体描述信息及本体查询工具,对用户的问题进行回答。",
25 "tools": [
26 {
27 "name": "",
28 "type": "queryObjectTool",
29 "config": {
30 "objectTypes": [
31 {
32 "name": "frontEndComponents",
33 "properties": [
34 "owner",
35 "if_combine",
36 "coo",
37 "low_freq_safe_stock",
38 "avl_status",
39 "moi_standard",
40 "material_no",
41 "vendor_id",
42 "lead_time",
43 "inventory",
44 "classification",
45 "has_available_source",
46 "is_domestic",
47 "material_name",
48 "main_material_no",
49 "vendor_quota",
50 "is_discontinued"
51 ]
52 }
53 ]
54 }
55 }
56 ],
57 "output": {
58 "type": "object",
59 "description": "",
60 "variableName": "origin_material",
61 "defaultValue": "",
62 "objectType": "frontEndComponents"
63 }
64 },
65 {
66 "type": "function",
67 "title": "确认要分析的真实物料号",
68 "funName": "getMainMaterialNo",
69 "funDescription": "确认要分析的真实物料号",
70 "funType": "javascript",
71 "input": [
72 {
73 "type": "object",
74 "description": "原物料基础信息",
75 "variableName": "origin_material",
76 "require": false,
77 "defaultValue": "",
78 "refVariableName": "origin_material",
79 "objectType": "frontEndComponents"
80 }
81 ],
82 "funCode": "// javascript代码编写\n// 请确保只有一个main函数,都需要在main函数中\n// 可以从params中获取到你定义的输入参数\nfunction main(params) {\n // 获取输入参数\n const origin_material = params.origin_material;\n \n // 1. 检查质检状态,如果不是Y则直接返回空字符串\n if (origin_material.avlStatus !== 'Y') {\n return \"\";\n }\n \n // 2. 检查绑定关系\n let materialNoToAnalyze;\n if (origin_material.ifCombine === 'N') {\n // 如果未绑定主物料,使用原物料号\n materialNoToAnalyze = origin_material.materialNo;\n } else {\n // 如果绑定主物料(包括if_combine为Y或空的情况),使用主物料号\n materialNoToAnalyze = origin_material.mainMaterialNo || \"\";\n }\n \n // 返回要分析的物料号\n return materialNoToAnalyze;\n}\n",
83 "output": {
84 "type": "string",
85 "description": "",
86 "variableName": "main_material_no",
87 "defaultValue": ""
88 }
89 },
90 {
91 "type": "use-llm",
92 "title": "获取物料分组的所有物料信息",
93 "model": "model_svc_8c4f_a0377d123123",
94 "taskPrompt": "请帮我查一下主物料号是 $main_material_no 并且 avl_status 是 Y 的所有物料的详细信息。",
95 "systemPrompt": "你是一个智能体,通过提供的实体描述信息及本体查询工具,对用户的问题进行回答。",
96 "tools": [
97 {
98 "name": "",
99 "type": "queryObjectTool",
100 "config": {
101 "objectTypes": [
102 {
103 "name": "frontEndComponents",
104 "properties": [
105 "owner",
106 "avl_status",
107 "main_material_no",
108 "material_no"
109 ]
110 }
111 ]
112 }
113 }
114 ],
115 "output": {
116 "type": "objectTypeArray",
117 "description": "",
118 "variableName": "material_group_info",
119 "defaultValue": "",
120 "objectType": "frontEndComponents"
121 }
122 },
123 {
124 "type": "function",
125 "title": "确认物料对应的owner",
126 "funName": "getMaterialRealOwner",
127 "funDescription": "确认物料对应的owner",
128 "funType": "javascript",
129 "input": [
130 {
131 "type": "objectTypeArray",
132 "description": "获取物料分组的所有物料信息",
133 "variableName": "material_group_info",
134 "require": false,
135 "defaultValue": "",
136 "refVariableName": "material_group_info",
137 "objectType": "frontEndComponents"
138 }
139 ],
140 "funCode": "function main(params) {\n // 获取物料分组信息\n const materialGroupInfo = params.material_group_info;\n \n // 过滤掉停供的物料\n const availableMaterials = materialGroupInfo.filter(item => item.is_discontinued !== 'Y');\n \n // 如果没有可用物料,返回空字符串\n if (availableMaterials.length === 0) {\n return \"\";\n }\n \n // 按照vendor_quota降序排序\n availableMaterials.sort((a, b) => b.vendor_quota - a.vendor_quota);\n \n // 返回配额最大的物料的owner\n // return 'ligong';\n return availableMaterials[0].owner;\n}",
141 "output": {
142 "type": "string",
143 "description": "",
144 "variableName": "real_owner",
145 "defaultValue": ""
146 }
147 },
148 {
149 "type": "output",
150 "output": [
151 {
152 "type": "string",
153 "description": "",
154 "variableName": "real_owner",
155 "refVariableName": "material_no",
156 "needPropertiesDesc": false,
157 "onlySelectedProperties": false
158 },
159 {
160 "type": "object",
161 "description": "",
162 "variableName": "origin_material",
163 "refVariableName": "origin_material",
164 "needPropertiesDesc": false,
165 "onlySelectedProperties": false
166 },
167 {
168 "type": "string",
169 "description": "",
170 "variableName": "main_material_no",
171 "refVariableName": "main_material_no",
172 "needPropertiesDesc": false,
173 "onlySelectedProperties": false
174 },
175 {
176 "type": "object",
177 "description": "",
178 "variableName": "material_group_info",
179 "refVariableName": "material_group_info",
180 "needPropertiesDesc": false,
181 "onlySelectedProperties": false
182 }
183 ]
184 }
185 ],
186 "createTime": "1/26/26, 8:49 PM",
187 "creatorName": "admin"
188}
评价此篇文章
