pudu-openapi-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePudu OpenAPI Skill
Pudu OpenAPI Skill
工作流
Workflow
1. 检查凭证 → 读取 / 提示 ApiAppKey & ApiAppSecret
2. 确认集群 → 读取 PUDU_API_CLUSTER;若缺失,必须询问用户选择,禁止默认任意集群 → 确定 BASE_URL
3. 理解用户意图 → 定位功能组 → 读取对应 assets/*.json
4. 归一化参数名 → 将用户输入字段映射为接口规范中的真实字段名
5. 构建并执行请求 → 按环境优先级执行脚本 (js -> py -> go -> java -> cs)
6. 展示结果 → 200 且 message=SUCCESS 美化输出,否则输出错误原因1. Check Credentials → Read / Prompt for ApiAppKey & ApiAppSecret
2. Confirm Cluster → Read PUDU_API_CLUSTER; if missing, must ask user to select, prohibit defaulting to any cluster → Determine BASE_URL
3. Understand User Intent → Locate functional group → Read corresponding assets/*.json
4. Normalize Parameter Names → Map user input fields to real field names specified in the interface specification
5. Build and Execute Request → Execute scripts according to environment priority (js -> py -> go -> java -> cs)
6. Display Results → Beautify output if status code is 200 and message=SUCCESS, otherwise output error cause第一步:检查凭证
Step 1: Check Credentials
优先从环境变量读取:
| 变量名 | 说明 |
|---|---|
| ApiAppKey |
| ApiAppSecret |
若任意变量缺失,停止执行并提示:
缺少以下凭证,请通过以下任一方式提供:方式一(推荐):设置环境变量bashexport PUDU_API_APP_KEY="your-key" export PUDU_API_APP_SECRET="your-secret"方式二:直接告诉我 请输入您的 ApiAppKey 和 ApiAppSecret。如果您还没有凭证 请访问 普渡开放平台快速开始 按照教程申请。
两项均确认后方可继续。
Read from environment variables first:
| Variable Name | Description |
|---|---|
| ApiAppKey |
| ApiAppSecret |
If any variable is missing, stop execution and prompt:
The following credentials are missing. Please provide them via one of the following methods:Method 1 (Recommended): Set environment variablesbashexport PUDU_API_APP_KEY="your-key" export PUDU_API_APP_SECRET="your-secret"Method 2: Tell me directly Please enter your ApiAppKey and ApiAppSecret.If you don't have credentials yet Please visit Pudu Open Platform Quick Start and follow the tutorial to apply.
Proceed only after both are confirmed.
敏感凭证处理规则
Sensitive Credential Handling Rules
- 优先建议用户通过环境变量提供凭证,而不是直接在对话中粘贴
- 若用户直接提供 ,不要在回复、日志、报错、示例代码中回显完整值
ApiAppSecret - 不要将用户提供的 /
ApiAppKey写入仓库文件、脚本常量或示例代码ApiAppSecret - 在排查问题时,只允许使用脱敏后的形式展示,例如
abc***xyz
- Prioritize suggesting users to provide credentials via environment variables instead of pasting directly in the conversation
- If the user provides directly, do not echo the full value in replies, logs, error messages, or sample code
ApiAppSecret - Do not write the user-provided /
ApiAppKeyinto repository files, script constants, or sample codeApiAppSecret - When troubleshooting, only display the desensitized form, e.g.,
abc***xyz
第二步:确认集群
Step 2: Confirm Cluster
优先读取环境变量 ,取值映射如下:
PUDU_API_CLUSTER| 环境变量值 | 集群 | hostname |
|---|---|---|
| 国内生产节点 | |
| 海外(日韩新加坡)生产节点 | |
| 德国生产节点 | |
| 美国生产节点 | |
若环境变量未设置、为空,或当前上下文中无法明确判断集群,必须使用 AskQuestion 工具让用户明确选择集群。
严禁在未获得用户确认时默认选择任意集群(包括但不限于默认使用 )。
cn在用户完成选择后,再提示可通过以下方式固化设置:
bash
export PUDU_API_CLUSTER="cn" # cn / sea / de / us所有接口请求的完整 URL 格式:
https://{hostname}/pudu-entry{path}First read the environment variable , with value mappings as follows:
PUDU_API_CLUSTER| Environment Variable Value | Cluster | hostname |
|---|---|---|
| Domestic Production Node | |
| Overseas (Japan, Korea, Singapore) Production Node | |
| Germany Production Node | |
| US Production Node | |
If the environment variable is not set, empty, or the cluster cannot be clearly determined in the current context, must use the AskQuestion tool to let the user explicitly select the cluster.
Strictly prohibit defaulting to any cluster (including but not limited to defaulting to ) without user confirmation.
cnAfter the user completes the selection, prompt that the setting can be persisted as follows:
bash
export PUDU_API_CLUSTER="cn" # cn / sea / de / usFull URL format for all interface requests:
https://{hostname}/pudu-entry{path}第三步:理解意图 → 定位接口
Step 3: Understand Intent → Locate Interface
根据用户描述,定位功能组并读取对应规范文件获取接口的路径、参数和请求体结构:
| 功能组 | 规范文件 | 典型场景 |
|---|---|---|
| 机器人状态与信息查询 | | 查状态、位置、任务状态 |
| 配送与运送任务 | | 下发配送任务、多点运送 |
| 跑腿任务 | | 跑腿模式任务 |
| 顶升与托盘任务 | | 顶升机器人任务、托盘订单 |
| 巡航任务 | | 巡航任务下发、巡航线路查询 |
| 呼叫任务 | | 自定义呼叫机器人 |
| 闪电匣专属功能 | | 舱门状态/控制、舱门拍照任务、电梯内切图 |
| 内容、语音与媒体 | | 屏幕展示、语音播报、音量 |
| 基础控制与数据上报 | | 充电、切换地图、位置上报、交管区上报与查询 |
| 清洁统计分析 | | 洗地、扫地等清洁模式图表及分页数据 |
| 通用统计分析 | | 机器概览、门店概览与运行分析数据 |
| 配送统计分析 | | 配送、呼叫、巡航等模式明细与图表数据 |
| 行业统计分析 | | 顶升等行业任务的统计明细及图表数据 |
| 简报数据 | | 门店和机器核心运行大盘数据 |
| 日志与上报记录 | | 开机自检、电池充电、故障事件等列表查询 |
| 任务调度与历史 | | 呼叫、配送等任务的目的地执行明细与时间轴 |
| 门店与基础数据 | | 门店列表查询、机器列表查询 |
| 地图服务 | | 获取地图列表、门店下地图列表、地图详情、当前地图、点位信息、点位分组、地图底图 |
| 广告播放与配置 | | 广告列表、详情、创建、更新、删除、场景菜单 |
| 货柜任务与货柜 SKU | | 商品 SKU 同步、SKU 查询、货柜列表、货柜配送下单 |
| 机器避险 | | 发起避险任务、解除避险任务 |
完整能力范围、典型场景和代表接口请参考:
references/capabilities.mdAccording to the user's description, locate the functional group and read the corresponding specification file to obtain the interface path, parameters, and request body structure:
| Functional Group | Specification File | Typical Scenarios |
|---|---|---|
| Robot Status and Information Query | | Query status, location, task status |
| Delivery and Transport Tasks | | Issue delivery tasks, multi-point transport |
| Errand Tasks | | Errand mode tasks |
| Lifting and Tray Tasks | | Lifting robot tasks, tray orders |
| Cruise Tasks | | Issue cruise tasks, query cruise routes |
| Call Tasks | | Custom call robot |
| Flash Cabinet Exclusive Functions | | Hatch door status/control, hatch door photo tasks, elevator internal screenshots |
| Content, Voice and Media | | Screen display, voice broadcast, volume |
| Basic Control and Data Reporting | | Charging, map switching, location reporting, traffic control zone reporting and query |
| Cleaning Statistical Analysis | | Charts and paginated data for cleaning modes like floor mopping, sweeping |
| General Statistical Analysis | | Machine overview, store overview and operation analysis data |
| Delivery Statistical Analysis | | Details and chart data for modes like delivery, call, cruise |
| Industry Statistical Analysis | | Statistical details and chart data for industry tasks like lifting |
| Briefing Data | | Core operation dashboard data for stores and machines |
| Logs and Reporting Records | | List query for self-test on startup, battery charging, fault events, etc. |
| Task Scheduling and History | | Execution details and timeline of destinations for tasks like call, delivery |
| Store and Basic Data | | Store list query, machine list query |
| Map Services | | Get map list, map list under store, map details, current map, point information, point grouping, map base map |
| Advertisement Playback and Configuration | | Advertisement list, details, creation, update, deletion, scenario menu |
| Cabinet Tasks and Cabinet SKU | | Product SKU synchronization, SKU query, cabinet list, cabinet delivery order placement |
| Machine Risk Avoidance | | Initiate risk avoidance task, cancel risk avoidance task |
For complete capability scope, typical scenarios and representative interfaces, please refer to:
references/capabilities.md第四步:参数名归一化
Step 4: Parameter Name Normalization
用户输入的参数名可能使用驼峰、下划线或中划线格式。构建 前,必须根据当前接口规范中的 和 schema,将用户字段自动映射为接口要求的真实字段名:
paramsparametersrequestBody- /
shopId/shop_id→ 按当前接口规范转换为shop-id或shopIdshop_id - /
groupId/group_id→ 按当前接口规范转换为group-id或groupIdgroup_id - /
payload.startPoint/payload.start_point→ 按 schema 转换为真实嵌套字段名payload.start-point
归一化规则:
- 用当前接口规范构建字段名白名单;不要凭常识自行决定最终字段名
- 匹配时忽略大小写,并忽略 和
_,但最终输出必须保留规范中的原始字段名格式- - 对 request body 的对象、数组对象也要递归应用同样规则
- 只转换字段名,不改变字段值
- 如果同一个输入字段可匹配多个规范字段,或字段不在规范中,先向用户确认;不要把未知字段直接发给接口
Parameter names entered by users may use camelCase, snake_case, or kebab-case formats. Before building , must automatically map user fields to the real field names required by the interface according to the and schema in the current interface specification:
paramsparametersrequestBody- /
shopId/shop_id→ Convert toshop-idorshopIdaccording to the current interface specificationshop_id - /
groupId/group_id→ Convert togroup-idorgroupIdaccording to the current interface specificationgroup_id - /
payload.startPoint/payload.start_point→ Convert to real nested field names according to the schemapayload.start-point
Normalization Rules:
- Build a whitelist of field names using the current interface specification; do not decide the final field names based on common sense
- Ignore case, and
_when matching, but the final output must retain the original field name format in the specification- - Apply the same rules recursively to objects and array objects in the request body
- Only convert field names, do not change field values
- If the same input field can match multiple specification fields, or the field is not in the specification, confirm with the user first; do not send unknown fields directly to the interface
第五步:构建并执行请求
Step 5: Build and Execute Request
构建参数并执行请求脚本。脚本执行优先级如下,当因为环境问题无法执行当前脚本时(如没有安装 Node.js),则依次向下尝试下一个脚本:
scripts/pudu-request.jsscripts/pudu-request.pyscripts/pudu-request.goscripts/pudu-request.javascripts/pudu-request.cs
示例(以执行 为例):
pudu-request.jsjs
const { request } = require("./scripts/pudu-request");
const result = await request({
cluster: process.env.PUDU_API_CLUSTER, // 或显式传入 "cn" / "sea" / "de" / "us"
path: "/pudu-entry<从规范文件读取的 path>",
method: "<GET 或 POST>",
params: { /* 从用户 prompt 和规范文件提取参数 */ },
apiAppKey: process.env.PUDU_API_APP_KEY,
apiAppSecret: process.env.PUDU_API_APP_SECRET,
});
if (result.ok) {
console.log(result.json);
} else {
console.error(result.errorMessage);
}说明:
- 会优先读取环境变量中的
request()、PUDU_API_APP_KEY、PUDU_API_APP_SECRETPUDU_API_CLUSTER - 若显式传入 /
apiAppKey/apiAppSecret/cluster,则以显式参数为准hostname - 需包含
path前缀,例如:/pudu-entry(如果接口是针对/pudu-entry/open-platform-service/v2/status/get_by_sn的统计接口,路径也会是类似/data-board等,具体以规范文件为准)/pudu-entry/data-board/v1/analysis/run - 需要根据用户 prompt 和 OpenAPI 规范文件共同构建,不能只靠自然语言猜测字段;发出请求前必须完成参数名归一化,确保所有字段名与规范完全一致
params - 当接口需要 时,若用户传入的值形如
sn,应判断为 MAC 地址而非 SN,并主动提醒用户改为提供真实机器人 SN14:80:CC:89:27:A6
Build parameters and execute the request script. The script execution priority is as follows; if the current script cannot be executed due to environment issues (e.g., Node.js not installed), try the next script in sequence:
scripts/pudu-request.jsscripts/pudu-request.pyscripts/pudu-request.goscripts/pudu-request.javascripts/pudu-request.cs
Example (taking execution of as an example):
pudu-request.jsjs
const { request } = require("./scripts/pudu-request");
const result = await request({
cluster: process.env.PUDU_API_CLUSTER, // Or explicitly pass "cn" / "sea" / "de" / "us"
path: "/pudu-entry<path read from specification file>",
method: "<GET or POST>",
params: { /* Parameters extracted from user prompt and specification file */ },
apiAppKey: process.env.PUDU_API_APP_KEY,
apiAppSecret: process.env.PUDU_API_APP_SECRET,
});
if (result.ok) {
console.log(result.json);
} else {
console.error(result.errorMessage);
}Explanation:
- will first read
request(),PUDU_API_APP_KEY,PUDU_API_APP_SECRETfrom environment variablesPUDU_API_CLUSTER - If /
apiAppKey/apiAppSecret/clusterare explicitly passed, the explicit parameters will take precedencehostname - must include the
pathprefix, e.g.,/pudu-entry(if the interface is a statistical interface for/pudu-entry/open-platform-service/v2/status/get_by_sn, the path will be similar to/data-board, etc., subject to the specification file)/pudu-entry/data-board/v1/analysis/run - needs to be built based on both the user prompt and the OpenAPI specification file; do not guess fields only by natural language; must complete parameter name normalization before sending the request to ensure all field names are completely consistent with the specification
params - When the interface requires , if the value passed by the user is in the format of
sn, it should be judged as a MAC address instead of SN, and the user should be actively reminded to provide the real robot SN14:80:CC:89:27:A6
第六步:展示结果
Step 6: Display Results
成功判定规则
Success Judgment Rules
只有同时满足以下条件才表示成功:
- HTTP 状态码为
200 - 返回结果中的
message === "SUCCESS"
成功响应示例:
json
{
"data": {
"count": 110,
"list": [
{
"company_id": "13947",
"company_name": "chixzdls_internal02二级代理商",
"shop_id": "324100000",
"shop_name": "【10月08日】出尘门店"
},
{
"company_id": "13947",
"company_name": "chixzdls_internal02二级代理商",
"shop_id": "325300001",
"shop_name": "闪电匣和很多葫芦"
}
]
},
"message": "SUCCESS",
"trace_id": "YourApiAppKey_405eb004-7f09-4d86-bff1-4657cdec2717"
}Only when the following conditions are met simultaneously is it considered successful:
- HTTP status code is
200 - in the returned result
message === "SUCCESS"
Success response example:
json
{
"data": {
"count": 110,
"list": [
{
"company_id": "13947",
"company_name": "chixzdls_internal02二级代理商",
"shop_id": "324100000",
"shop_name": "【10月08日】出尘门店"
},
{
"company_id": "13947",
"company_name": "chixzdls_internal02二级代理商",
"shop_id": "325300001",
"shop_name": "闪电匣和很多葫芦"
}
]
},
"message": "SUCCESS",
"trace_id": "YourApiAppKey_405eb004-7f09-4d86-bff1-4657cdec2717"
}判定成功时的展示方式
Display Method When Successful
将 解析为 JSON 并美化展示:
body✅ 调用成功
接口:GET /open-platform-service/v2/status/get_by_sn
集群:国内生产节点
{
"message": "SUCCESS",
"data": {
"sn": "robot-001",
"runState": "IDLE",
"battery": 85,
...
}
}Parse the into JSON and display it beautifully:
body✅ Call Successful
Interface: GET /open-platform-service/v2/status/get_by_sn
Cluster: Domestic Production Node
{
"message": "SUCCESS",
"data": {
"sn": "robot-001",
"runState": "IDLE",
"battery": 85,
...
}
}判定失败时的展示方式
Display Method When Failed
以下任一情况都视为失败:
- HTTP 状态码非
200 - HTTP 状态码为 ,但
200message !== "SUCCESS"
解析错误信息并输出:
❌ 调用失败(HTTP 401)
接口:GET /open-platform-service/v2/status/get_by_sn
错误原因:Unauthorized — ApiAppKey 或签名验证失败,请检查凭证是否正确。常见错误码参考:
| HTTP 状态码 | 含义 | 处理建议 |
|---|---|---|
| 401 | 签名验证失败 | 检查 ApiAppKey / ApiAppSecret 是否正确 |
| 403 | 无权限 | 确认接口是否已开通 |
| 404 | 接口路径不存在 | 检查 path 和集群是否匹配 |
| 500 | 服务端错误 | 重试或联系普渡技术支持 |
Any of the following situations is considered a failure:
- HTTP status code is not
200 - HTTP status code is , but
200message !== "SUCCESS"
Parse the error message and output:
❌ Call Failed (HTTP 401)
Interface: GET /open-platform-service/v2/status/get_by_sn
Error Cause: Unauthorized — ApiAppKey or signature verification failed, please check if the credentials are correct.Common Error Code Reference:
| HTTP Status Code | Meaning | Handling Suggestion |
|---|---|---|
| 401 | Signature verification failed | Check if ApiAppKey / ApiAppSecret are correct |
| 403 | No permission | Confirm whether the interface has been activated |
| 404 | Interface path does not exist | Check if path and cluster match |
| 500 | Server error | Retry or contact Pudu technical support |
常用接口速查
Quick Reference for Common Interfaces
undefinedundefined查询机器人状态(推荐 v2)
Query Robot Status (v2 recommended)
GET /open-platform-service/v2/status/get_by_sn?sn={sn}
GET /open-platform-service/v1/status/get_by_group_id?groupId={groupId}
GET /open-platform-service/v2/status/get_by_sn?sn={sn}
GET /open-platform-service/v1/status/get_by_group_id?groupId={groupId}
下发任务
Issue Tasks
POST /open-platform-service/v1/delivery_task
POST /open-platform-service/v1/transport_task
POST /open-platform-service/v1/delivery_task
POST /open-platform-service/v1/transport_task
一键回充(推荐 v2)
One-click Recharge (v2 recommended)
GET /open-platform-service/v2/recharge?sn={sn}
GET /open-platform-service/v2/recharge?sn={sn}
呼叫机器人
Call Robot
POST /open-platform-service/v1/custom_call
POST /open-platform-service/v1/custom_call
地图与交管区
Maps and Traffic Control Zones
GET /data-open-platform-service/v1/api/maps?shop_id={shop_id}
POST /map-service/v1/open/traffic_control/list
GET /data-open-platform-service/v1/api/maps?shop_id={shop_id}
POST /map-service/v1/open/traffic_control/list
查询机器运行概览和分析
Query Machine Operation Overview and Analysis
GET /data-board/v1/brief/run?shopId={shopId}
GET /data-board/v1/analysis/run?shopId={shopId}
GET /data-board/v1/brief/run?shopId={shopId}
GET /data-board/v1/analysis/run?shopId={shopId}
广告播放与配置
Advertisement Playback and Configuration
POST /biz-service/openPlatform/api/v1/gg/list
GET /biz-service/openPlatform/api/v1/gg/get?id={id}&shop_id={shop_id}
POST /biz-service/openPlatform/api/v1/gg/create
POST /biz-service/openPlatform/api/v1/gg/list
GET /biz-service/openPlatform/api/v1/gg/get?id={id}&shop_id={shop_id}
POST /biz-service/openPlatform/api/v1/gg/create
货柜任务与货柜 SKU
Cabinet Tasks and Cabinet SKU
POST /community-open-service/api/product_sku/v2/upsert
GET /community-open-service/api/cabinet/v1/list?shop_id={shop_id}
POST /community-open-service/api/cabinet/send_task
POST /community-open-service/api/product_sku/v2/upsert
GET /community-open-service/api/cabinet/v1/list?shop_id={shop_id}
POST /community-open-service/api/cabinet/send_task
闪电匣舱门拍照
Flash Cabinet Hatch Door Photo
POST /biz-open-service/v1/robotDoor/task_list
---POST /biz-open-service/v1/robotDoor/task_list
---注意事项
Notes
- v2 接口优先于旧版本(),
status/get_by_sn请优先使用 v2,状态字段更简洁recharge - 标注 的接口仅适用于带货柜的机器人型号
(闪电匣) - 为机器人序列号,
sn为门店 ID,是最常用的标识字段shopId - MAC 地址常见格式为 ;若接口要求
14:80:CC:89:27:A6,不能直接用 MAC 地址替代sn - 配送、运送、跑腿、顶升等任务有对应的 接口用于暂停/继续/取消
*_action - 如果用户有编写Open API请求 sdk 的意图,根据用户指定的编程语言,参考 ,输出对应语言的标准实现范例。
references/request-sdk.md
- v2 interfaces take precedence over older versions (e.g., ), please use v2 for
status/get_by_snas the status fields are more conciserecharge - Interfaces marked with are only applicable to robot models with cabinets
(Flash Cabinet) - is the robot serial number,
snis the store ID, which are the most commonly used identification fieldsshopId - MAC addresses are commonly in the format of ; if the interface requires
14:80:CC:89:27:A6, do not directly use a MAC address insteadsn - Tasks such as delivery, transport, errand, lifting have corresponding interfaces for pause/resume/cancel
*_action - If the user intends to write an Open API request SDK, according to the programming language specified by the user, refer to and output a standard implementation example in the corresponding language.
references/request-sdk.md