custom-object-management

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Source of truth

事实来源

hubspot schemas --help
is authoritative. Subcommands:
list
,
get
,
create
,
update
(metadata only),
delete
(destructive). Schema writes require a private app token with
crm.schemas.custom.write
. Read
bulk-operations/SKILL.md
first — every command here uses its JSONL conventions, and
schemas delete
uses its dry-run / digest / confirm flow.
hubspot schemas --help
是权威参考。子命令包括:
list
get
create
update
(仅元数据)、
delete
(破坏性操作)。模式写入需要具备
crm.schemas.custom.write
权限的私有应用令牌。请先阅读
bulk-operations/SKILL.md
——此处的所有命令均遵循其JSONL约定,且
schemas delete
使用其试运行/摘要/确认流程。

Discover existing schemas

发现现有模式

bash
hubspot schemas list                                       # JSONL: name, label, singular, objectTypeId, source
hubspot schemas list | jq 'select(.source=="custom")'      # custom only
hubspot objects types | jq -c 'select(.source=="custom")'  # same set, also shown to confirm `--type` resolves
name
is what every other command takes.
objectTypeId
(e.g.
2-12345678
) is only needed for workflow
PLATFORM_FLOW
targets.
bash
hubspot schemas list                                       # JSONL格式:name、label、singular、objectTypeId、source
hubspot schemas list | jq 'select(.source=="custom")'      # 仅显示自定义模式
hubspot objects types | jq -c 'select(.source=="custom")'  # 同一数据集,也可用于确认`--type`参数是否解析正确
name
是其他所有命令所需的参数。
objectTypeId
(例如
2-12345678
)仅在工作流
PLATFORM_FLOW
目标中需要。

Inspect one schema

查看单个模式

bash
hubspot schemas get pets
Returns the full definition — properties, associations, labels,
requiredProperties
,
primaryDisplayProperty
,
fullyQualifiedName
. Reshape with
jq
as needed (see
bulk-operations/resources/json-patterns.md
).
bash
hubspot schemas get pets
返回完整定义——包括属性、关联关系、标签、
requiredProperties
primaryDisplayProperty
fullyQualifiedName
。可根据需要使用
jq
调整格式(请参阅
bulk-operations/resources/json-patterns.md
)。

Create a schema

创建模式

Build a JSON body and pipe it (or pass
--file
). Minimal valid body:
json
{
  "name": "equipment",
  "labels": {"singular": "Equipment", "plural": "Equipment"},
  "primaryDisplayProperty": "equipment_name",
  "requiredProperties": ["equipment_name"],
  "properties": [
    {"name": "equipment_name", "label": "Name", "type": "string", "fieldType": "text"}
  ],
  "associatedObjects": ["contacts"]
}
bash
cat equipment-schema.json | hubspot schemas create --dry-run   # preview
hubspot schemas create --file equipment-schema.json            # execute
Add more properties later with
hubspot properties create --type <name> ...
.
构建JSON主体并通过管道传递(或使用
--file
参数)。最小有效主体如下:
json
{
  "name": "equipment",
  "labels": {"singular": "Equipment", "plural": "Equipment"},
  "primaryDisplayProperty": "equipment_name",
  "requiredProperties": ["equipment_name"],
  "properties": [
    {"name": "equipment_name", "label": "Name", "type": "string", "fieldType": "text"}
  ],
  "associatedObjects": ["contacts"]
}
bash
cat equipment-schema.json | hubspot schemas create --dry-run   # 预览操作
hubspot schemas create --file equipment-schema.json            # 执行操作
后续可使用
hubspot properties create --type <name> ...
添加更多属性。

Update schema metadata

更新模式元数据

update
patches labels / description only. Property edits go through
hubspot properties
.
bash
echo '{"labels":{"singular":"Device","plural":"Devices"}}' | hubspot schemas update equipment
update
also supports
--dry-run
→ digest → re-run with
--digest --confirm <name>
(see
bulk-operations/SKILL.md
for the pattern).
update
命令仅用于修改标签/描述。属性编辑需通过
hubspot properties
命令完成。
bash
echo '{"labels":{"singular":"Device","plural":"Devices"}}' | hubspot schemas update equipment
update
命令也支持
--dry-run
→ 生成摘要 → 使用
--digest --confirm <name>
重新运行(模式请参阅
bulk-operations/SKILL.md
)。

Delete a schema (destructive)

删除模式(破坏性操作)

Schema delete is destructive and irreversible — it permanently removes the schema and every record of that type. It is gated as
MetadataDestroy
: every delete requires
--dry-run
first, then re-run with
--digest <hash> --confirm <name>
within 5 minutes.
Follow the three-step flow documented in
bulk-operations/SKILL.md
("Safe destructive workflow"). For schemas, the confirm value is the schema name:
bash
hubspot schemas delete equipment --dry-run
删除模式是破坏性且不可逆的操作——它会永久删除模式以及该类型的所有记录。此操作属于
MetadataDestroy
权限范畴:每次删除都必须先执行
--dry-run
,然后在5分钟内使用
--digest <hash> --confirm <name>
重新运行。
请遵循
bulk-operations/SKILL.md
中记录的三步流程(“安全破坏性工作流”)。对于模式,确认值为模式名称:
bash
hubspot schemas delete equipment --dry-run

→ digest=blast-... ; apply_command_hint shows: --digest <hash> --confirm 'equipment'

→ digest=blast-... ; apply_command_hint显示:--digest <hash> --confirm 'equipment'

hubspot schemas delete equipment --digest <hash> --confirm equipment

Check `hubspot history --since 24h --kind MetadataDestroy` to audit recent schema deletes.
hubspot schemas delete equipment --digest <hash> --confirm equipment

可查看`hubspot history --since 24h --kind MetadataDestroy`来审计最近的模式删除操作。

Using the schema after creation

创建模式后的使用

Once a schema exists, all
hubspot objects ...
commands accept its
name
as
--type
(e.g.
--type pets
). Record CRUD, search, association, bulk upsert — all identical to standard objects. Don't re-implement those flows here; see
bulk-operations/SKILL.md
and
crm-lookup
.
模式创建完成后,所有
hubspot objects ...
命令都可接受其
name
作为
--type
参数(例如
--type pets
)。记录CRUD、搜索、关联、批量更新插入——所有操作均与标准对象相同。无需在此处重新实现这些流程;请参阅
bulk-operations/SKILL.md
crm-lookup