hap-cli(command hap) wraps the backend capabilities of the HAP enterprise platform into a command line, covering:
contacts and departments, chat messages and groups, updates, schedules, worksheet record read/write, views and fields,
workflows and approval to-dos, custom pages, role permissions, organization and application management, file upload and sharing.
Step 1: Confirm hap is installed
hap --version
If a version number is output, skip to the next step. reports command not found , install it first:
pip install hap-cli
After installing, run hap --version again to confirm. If pip installed successfully but hap still cannot be found, it means it was installed into a Python environment
that is not on PATH; use python3 -m pip install --user hap-cliinstead, or use
python3 -m hap_cli instead of hap to invoke it.
After installation, log in:
hap auth login # 明道云 SaaS,会打开浏览器
hap auth whoami # 确认登录成功、当前组织正确
For private deployment, multiple environments and accounts, and settings for the organization and default application, see the next step's hap guide setup。
Step 2: Before doing anything, first run hap guide
hap guide
It will giveon this machine, for this version of hap 's complete command map, available detailed topics, and the most common pitfalls. The command map is generated on the spot and is always consistent with the commands that can actually be run.
If you need details on a specific aspect, go deeper according to the topics listed in the hap guide output, for example the value format for writing records,
login and environment management, reaching records from messages, and when to hand off to other skills.
Iron rules
Do not assemble command names or parameters from memory.
hap-cli upgrades automatically, and commands and parameters change. At all times, rely on these two:
hap guide— what can be done and which path to takehap <命令> --help— the exact parameters of this command
Be especially careful when writing data: the value formats for different field types differ greatly, andpassing them wrong basically will not report an error, the server will still return success but the data is corrupted. Before starting, first look at the record writing topic in hap guide , and after writing, read it back to confirm.