openydt-api-explorer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCRITICAL:开始前 MUST 先用 Read 工具读取(认证 / profile / 签名 / 状态码 / 限速 / 安全规则)。../openydt-shared/SKILL.md与一等命令走完全相同的签名、包络、退出码与限速逻辑,未读共享基座不要执行任何命令。openydt api
CRITICAL: MUST use the Read tool to readbefore starting (authentication / profile / signature / status codes / rate limiting / security rules). The../openydt-shared/SKILL.mdfollows exactly the same signature, envelope, exit code and rate limiting logic as first-class commands. Do not execute any commands without reading the shared base.openydt api
何时用本技能
When to use this skill
平台共 423 个接口,只有约 143 个被做成了域一等命令(,参数已结构化为 flag)。当你要调的接口没有专属子命令时,用本技能的通用兜底:
openydt <域> <命令>bash
openydt api <cmd> --body '{...}'apiPOST- 城市运营券(创建/发放城市运营券模板)
cityOperationCoupon - 第三方车场缴费接入回执
thirdParkForBolian - 上行数据上报回执(如
upward)asynSuccess - 小区门禁(如
community)getAuthCommunities - 广告统计、
ad/preferential积分兑换、score发票、invoice用户认证等ydtUser
这些域在 里 (没生成一等命令),但只要 就能用 直接调。
catalog.jsonincluded=falsedirection=callableapi选择顺序:先找一等命令(或对应域技能),找不到再用openydt <域> --help兜底。一等命令把参数拆成了 flag、自动判定读写、更不易出错;api是“原始 JSON 直发”,更通用但要你自己保证 body 正确。api
The platform has a total of 423 interfaces, only about 143 of which are made into first-class domain commands (, with parameters structured as flags). When the interface you want to call does not have an exclusive subcommand, use the universal fallback of this skill:
openydt <domain> <command>bash
openydt api <cmd> --body '{...}'apiPOST- City Operation Coupons (create/issue city operation coupon templates)
cityOperationCoupon - Third-party Parking Lot Payment Access Receipts
thirdParkForBolian - Upward Data Reporting Receipts (e.g.,
upward)asynSuccess - Community Access Control (e.g.,
community)getAuthCommunities - Advertising Statistics,
ad/preferentialPoint Redemption,scoreInvoices,invoiceUser Authentication, etc.ydtUser
These domains have in (no first-class commands generated), but can be directly called with as long as .
included=falsecatalog.jsonapidirection=callablePriority order: First look for first-class commands (or corresponding domain skills), useopenydt <domain> --helpas fallback if not found. First-class commands split parameters into flags, automatically determine read/write status, and are less error-prone;apiis "raw JSON direct send", more general but requires you to ensure the body is correct.api
用法:openydt api
Usage: openydt api
bash
undefinedbash
undefined1) 行内 JSON body(最常用)
1) Inline JSON body (most commonly used)
openydt api getParkFee --body '{"parkCode":"1ZS7H5PQH9","carCode":"粤EJW962"}'
openydt api getParkFee --body '{"parkCode":"1ZS7H5PQH9","carCode":"粤EJW962"}'
2) 无参接口可省略 body
2) Omit body for parameterless interfaces
openydt api getAuthParkCodes
openydt api getAuthParkCodes
3) 从文件读 body
3) Read body from file
openydt api getParkOnSiteCar --body-file ./body.json
openydt api getParkOnSiteCar --body-file ./body.json
4) 从 stdin 读 body(- 表示 stdin),适合管道 / 大 body
4) Read body from stdin (- indicates stdin), suitable for pipelines / large bodies
echo '{"parkCode":"PTD2YBBZ"}' | openydt api getParkOnSiteCar --body-file -
- `<cmd>`:业务编码,**就是 catalog 里的 `cmd` 字段**(如 `getParkFee`、`createCityOperationCouponTemplate`)。注意是 cmd,不是 `dir` 路径。
- `--body` 与 `--body-file` **互斥**;二者都不给则发送空 body(`{}`),仅适合无参接口。
- body 是**原始 JSON**:CLI 会先做 JSON compact 再用于签名与发送(与一等命令一致),字符串内部空格如 `"2019-04-16 00:11:25"` 会保留。
- 参数命名与嵌套结构**完全照搬接口定义**(见下文从 catalog 查参数);写错字段名通常返回 `status=2 / resultCode=909 请求参数错误` 或 `status=7 请求参数不完整`。echo '{"parkCode":"PTD2YBBZ"}' | openydt api getParkOnSiteCar --body-file -
- `<cmd>`: Business code, **exactly the `cmd` field in the catalog** (e.g., `getParkFee`, `createCityOperationCouponTemplate`). Note it's the cmd, not the `dir` path.
- `--body` and `--body-file` are **mutually exclusive**; if neither is provided, an empty body (`{}`) is sent, only suitable for parameterless interfaces.
- Body is **raw JSON**: The CLI will first compact the JSON before using it for signature and sending (consistent with first-class commands), spaces inside strings like `"2019-04-16 00:11:25"` will be preserved.
- Parameter naming and nested structure **follow the interface definition exactly** (see checking parameters from catalog below); incorrect field names usually return `status=2 / resultCode=909 Request parameter error` or `status=7 Request parameter incomplete`.--dry-run 预览
--dry-run Preview
不确定 body 或在 prod 环境前,先用 只打印将发送的签名请求(URL / sign / ts / compact 后的 body),不实际发送:
--dry-runbash
openydt api createCityOperationCouponTemplate --dry-run \
--body '{"parkCodeList":["PRJ9YJ19"],"couponTemplate":{"name":"抵扣1元券","faceValue":1}}'If you are unsure about the body or before using in prod environment, use to only print the signed request to be sent (URL / sign / ts / compacted body) without actually sending:
--dry-runbash
openydt api createCityOperationCouponTemplate --dry-run \
--body '{"parkCodeList":["PRJ9YJ19"],"couponTemplate":{"name":"1-yuan Discount Coupon","faceValue":1}}'写操作必须 --yes(重要:api 不自动判定读写)
Write operations require --yes (Important: api does not automatically determine read/write)
api- 凡是会改变平台状态的 cmd(建/改/删、发券、缴费、开闸、上报回执等),你必须显式加 ,否则被安全拦截不执行。
--yes - 一等命令会自己识别写操作并要求 ;
--yes不会替你识别,所以用api调写接口时务必自己确认 readwrite 并加api。--yes - 判断某 cmd 读写:查 catalog 的 字段(
readwrite/read),见下文。write
bash
undefinedThe command itself does not determine whether a cmd is read or write; it is entirely your responsibility to confirm whether confirmation is needed:
api- For any cmd that changes the platform state (create/update/delete, issue coupons, pay fees, open gates, report receipts, etc.), you must explicitly add , otherwise it will be blocked by security and not executed.
--yes - First-class commands automatically identify write operations and require ;
--yeswill not do this for you, so when usingapito call write interfaces, be sure to confirm readwrite status yourself and addapi.--yes - To determine if a cmd is read or write: Check the field (
readwrite/read) in the catalog, see below.write
bash
undefined写操作(catalog readwrite=write),必须 --yes
Write operation (catalog readwrite=write), must add --yes
openydt api createCityOperationCouponTemplate --yes
--body '{"parkCodeList":["PRJ9YJ19"],"couponTemplate":{"name":"抵扣1元券","totalNum":2,"couponType":1,"faceValue":1,"validFrom":"2019-04-28 00:00:00","validTo":"2020-04-28 00:00:00"}}'
--body '{"parkCodeList":["PRJ9YJ19"],"couponTemplate":{"name":"抵扣1元券","totalNum":2,"couponType":1,"faceValue":1,"validFrom":"2019-04-28 00:00:00","validTo":"2020-04-28 00:00:00"}}'
undefinedopenydt api createCityOperationCouponTemplate --yes
--body '{"parkCodeList":["PRJ9YJ19"],"couponTemplate":{"name":"1-yuan Discount Coupon","totalNum":2,"couponType":1,"faceValue":1,"validFrom":"2019-04-28 00:00:00","validTo":"2020-04-28 00:00:00"}}'
--body '{"parkCodeList":["PRJ9YJ19"],"couponTemplate":{"name":"1-yuan Discount Coupon","totalNum":2,"couponType":1,"faceValue":1,"validFrom":"2019-04-28 00:00:00","validTo":"2020-04-28 00:00:00"}}'
undefined从 catalog 查可用 cmd 及参数
Check available cmds and parameters from catalog
接口清单在 (绝对路径 )。顶层结构 ,每个 interface 对象关键字段:
../../catalog/catalog.json/Users/zhoujw/develop/tmp/openydt-cli/catalog/catalog.json{generatedFrom, count, interfaces:[...]}| 字段 | 含义 |
|---|---|
| 业务编码,直接作为 |
| 所属域 / 文档路径(仅供归类,不是 api 的入参) |
| |
| |
| 是否已做成一等命令; |
| 未做成一等命令的原因( |
| 参数定义数组: |
| 官方示例请求 body——构造 |
| 示例响应,帮你预判返回字段 |
用 / 检索(不要在终端打印密钥,这里只查清单不涉及凭据):
jqpython3bash
undefinedThe interface list is in (absolute path ). The top-level structure is , each interface object has key fields:
../../catalog/catalog.json/Users/zhoujw/develop/tmp/openydt-cli/catalog/catalog.json{generatedFrom, count, interfaces:[...]}| Field | Meaning |
|---|---|
| Business code, directly used as the cmd in |
| Belonging domain / document path (for classification only, not an input parameter for api) |
| |
| |
| Whether it has been made into a first-class command; |
| Reason for not being made into a first-class command ( |
| Parameter definition array: |
| Official sample request body——the best starting point for constructing |
| Sample response, helps you predict returned fields |
Use / to retrieve (do not print secrets in the terminal, only check the list here without involving credentials):
jqpython3bash
undefined按 cmd 看完整定义(params + sampleBody)
View complete definition by cmd (params + sampleBody)
jq '.interfaces[] | select(.cmd=="createCityOperationCouponTemplate")' catalog/catalog.json
jq '.interfaces[] | select(.cmd=="createCityOperationCouponTemplate")' catalog/catalog.json
列出某个未点名域所有“可调用”的 cmd 及读写
List all callable cmds and their read/write status in a specific unnamed domain
jq -r '.interfaces[] | select(.domain=="cityOperationCoupon" and .direction=="callable") | "(.cmd)\t(.readwrite)\t(.explain)"' catalog/catalog.json
jq -r '.interfaces[] | select(.domain=="cityOperationCoupon" and .direction=="callable") | "(.cmd)\t(.readwrite)\t(.explain)"' catalog/catalog.json
全量“没做成一等命令但可调用”的接口(included=false 且 callable)
Full list of interfaces that are not made into first-class commands but callable (included=false and callable)
jq -r '.interfaces[] | select(.included==false and .direction=="callable") | "(.domain)\t(.cmd)\t(.readwrite)"' catalog/catalog.json
jq -r '.interfaces[] | select(.included==false and .direction=="callable") | "(.domain)\t(.cmd)\t(.readwrite)"' catalog/catalog.json
只看某 cmd 的参数清单(含嵌套 group)
View only the parameter list of a specific cmd (including nested groups)
jq '.interfaces[] | select(.cmd=="createCityOperationCouponTemplate") | .params' catalog/catalog.json
**included=false 但 direction=callable 的接口照样能用 `api` 调**——常见于城市运营券、第三方车场接入(thirdParkForBolian)、上行回执(upward)、小区门禁(community)、广告/积分/发票/ydtUser 等“未点名域”。`included=false` 只是“没生成专属命令”,不代表“不能调”;判断能否调用看 `direction`,判断要不要 `--yes` 看 `readwrite`。
构造流程:① `jq` 取目标 cmd 的 `sampleBody` → ② 照抄字段名、按 `params` 校对必填/类型/嵌套 → ③ `--dry-run` 预览签名请求 → ④ 写操作加 `--yes` 正式发。jq '.interfaces[] | select(.cmd=="createCityOperationCouponTemplate") | .params' catalog/catalog.json
**Interfaces with included=false but direction=callable can still be invoked with `api`**——common in "unnamed domains" such as city operation coupons, third-party parking lot access (thirdParkForBolian), upward receipts (upward), community access control (community), advertising/points/invoices/ydtUser, etc. `included=false` only means "no exclusive command generated", not "cannot be invoked"; check `direction` to determine if it can be invoked, check `readwrite` to determine if `--yes` is needed.
Construction process: ① Use `jq` to get the `sampleBody` of the target cmd → ② Copy the field names, verify required/type/nesting according to `params` → ③ Preview the signed request with `--dry-run` → ④ Add `--yes` for write operations and send officially.不能调用的 webhook(平台主动推送)
Uncallable webhooks (platform active push)
catalog 中 的接口(共 61 个,如 车位变更上报)是平台主动 POST 到你方接收端的回调,方向与 callable 相反:
direction=webhookreportParkinglotChange- CLI 不能主动调这些 cmd——它们没有“你方请求平台”的入口,不是正确用法(平台不提供该方向端点)。
openydt api <webhook-cmd> - 要接收这类推送,需你自建一个 HTTP 接收端(webhook receiver),向平台登记回调地址,由平台在事件发生时把 形态的数据 POST 给你;你的服务负责验签、处理并按约定返回(很多上行回执对应一个
sampleBody域的 callable 确认 cmd,如upward)。asynSuccess - 区分方法:调用前先 ,是
jq '.interfaces[]|select(.cmd=="<cmd>")|.direction'就别用webhook调,改为自建接收端;是api才用callable。api
Interfaces with in the catalog (61 in total, such as parking space change report) are callbacks actively POSTed by the platform to your receiving end, with the opposite direction of callable:
direction=webhookreportParkinglotChange- CLI cannot actively call these cmds——they do not have an entry for "your side requests the platform", and is not the correct usage (the platform does not provide an endpoint for this direction).
openydt api <webhook-cmd> - To receive such pushes, you need to build your own HTTP receiver (webhook receiver), register the callback address with the platform, and the platform will POST data in the form of to you when an event occurs; your service is responsible for verifying the signature, processing it, and returning as agreed (many upward receipts correspond to a callable confirmation cmd in the
sampleBodydomain, such asupward).asynSuccess - Distinction method: Before calling, run ; if it is
jq '.interfaces[]|select(.cmd=="<cmd>")|.direction', do not usewebhookto call it, instead build a receiving end; if it isapi, usecallable.api
示例
Examples
查某未点名域有哪些可调 cmd(读,纯查 catalog,不发请求):
bash
jq -r '.interfaces[] | select(.domain=="thirdParkForBolian" and .direction=="callable") | "\(.cmd)\t\(.readwrite)"' catalog/catalog.json用 sampleBody 起手、先预览再发(写操作示例,正式发要加 ):
--yesbash
undefinedCheck which cmds can be invoked in an unnamed domain (read, only check catalog, no request sent):
bash
jq -r '.interfaces[] | select(.domain=="thirdParkForBolian" and .direction=="callable") | "\(.cmd)\t\(.readwrite)"' catalog/catalog.jsonStart with sampleBody, preview first then send (write operation example, add for official sending):
--yesbash
undefined1) 取示例 body
1) Get sample body
jq -r '.interfaces[]|select(.cmd=="createCityOperationCouponTemplate")|.sampleBody' catalog/catalog.json
jq -r '.interfaces[]|select(.cmd=="createCityOperationCouponTemplate")|.sampleBody' catalog/catalog.json
2) 预览签名请求,确认无误
2) Preview signed request to confirm correctness
openydt api createCityOperationCouponTemplate --dry-run --body-file ./body.json
openydt api createCityOperationCouponTemplate --dry-run --body-file ./body.json
3) 正式发(写操作,必须 --yes)
3) Official sending (write operation, must add --yes)
openydt api createCityOperationCouponTemplate --yes --body-file ./body.json
读接口直接调(无需 --yes):
```bash
echo '{}' | openydt api getAuthCommunities --body-file - # community 域,readwrite=readopenydt api createCityOperationCouponTemplate --yes --body-file ./body.json
Call read interfaces directly (no --yes needed):
```bash
echo '{}' | openydt api getAuthCommunities --body-file - # community domain, readwrite=read