b2c-scapi-schemas

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

B2C SCAPI Schemas Skill

B2C SCAPI Schemas Skill

Use the
b2c
CLI plugin to browse and retrieve SCAPI OpenAPI schema specifications.
Tip: If
b2c
is not installed globally, use
npx @salesforce/b2c-cli
instead (e.g.,
npx @salesforce/b2c-cli scapi schemas list
).
使用
b2c
CLI插件来浏览和获取SCAPI OpenAPI schema规范。
提示: 如果没有全局安装
b2c
,请改用
npx @salesforce/b2c-cli
(例如
npx @salesforce/b2c-cli scapi schemas list
)。

Required: Tenant ID

必备项:租户ID(Tenant ID)

The
--tenant-id
flag is required for all commands. The tenant ID identifies your B2C Commerce instance.
Important: The tenant ID is NOT the same as the organization ID:
  • Tenant ID:
    zzxy_prd
    (used with commands that require
    --tenant-id
    )
  • Organization ID:
    f_ecom_zzxy_prd
    (used in SCAPI URLs, has
    f_ecom_
    prefix)
所有命令都必须
--tenant-id
参数。租户ID用于标识你的B2C Commerce实例。
重要提示: 租户ID和组织ID(Organization ID)并不相同:
  • 租户ID
    zzxy_prd
    (用于需要
    --tenant-id
    参数的命令)
  • 组织ID
    f_ecom_zzxy_prd
    (用于SCAPI URL中,带有
    f_ecom_
    前缀)

Deriving Tenant ID from Hostname

从主机名推导租户ID

For sandbox instances, you can derive the tenant ID from the hostname by replacing hyphens with underscores:
HostnameTenant ID
zzpq-013.dx.commercecloud.salesforce.com
zzpq_013
zzxy-001.dx.commercecloud.salesforce.com
zzxy_001
abcd-dev.dx.commercecloud.salesforce.com
abcd_dev
For production instances, use your realm and instance identifier (e.g.,
zzxy_prd
).
对于沙箱实例,你可以将主机名中的连字符替换为下划线,即可得到租户ID:
主机名租户ID
zzpq-013.dx.commercecloud.salesforce.com
zzpq_013
zzxy-001.dx.commercecloud.salesforce.com
zzxy_001
abcd-dev.dx.commercecloud.salesforce.com
abcd_dev
对于生产实例,请使用你的领域和实例标识符(例如
zzxy_prd
)。

Examples

示例

List Available Schemas

列出可用的Schema

bash
undefined
bash
undefined

list all available SCAPI schemas

list all available SCAPI schemas

b2c scapi schemas list --tenant-id zzxy_prd
b2c scapi schemas list --tenant-id zzxy_prd

list with JSON output

list with JSON output

b2c scapi schemas list --tenant-id zzxy_prd --json
undefined
b2c scapi schemas list --tenant-id zzxy_prd --json
undefined

Filter Schemas

过滤Schema

bash
undefined
bash
undefined

filter by API family (e.g., product, checkout, search)

filter by API family (e.g., product, checkout, search)

b2c scapi schemas list --tenant-id zzxy_prd --api-family product
b2c scapi schemas list --tenant-id zzxy_prd --api-family product

filter by API name

filter by API name

b2c scapi schemas list --tenant-id zzxy_prd --api-name shopper-products
b2c scapi schemas list --tenant-id zzxy_prd --api-name shopper-products

filter by status

filter by status

b2c scapi schemas list --tenant-id zzxy_prd --status current
undefined
b2c scapi schemas list --tenant-id zzxy_prd --status current
undefined

Get Schema (Collapsed/Outline - Default)

获取Schema(默认折叠/大纲模式)

By default, schemas are output in a collapsed format optimized for context efficiency. This is ideal for agentic use cases and LLM consumption.
bash
undefined
默认情况下,Schema会以折叠格式输出,针对上下文效率做了优化,非常适合Agent使用场景和LLM消费。
bash
undefined

get collapsed schema (paths show methods, schemas show names only)

get collapsed schema (paths show methods, schemas show names only)

b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd
b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd

save to file

save to file

b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd > schema.json
undefined
b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd > schema.json
undefined

Get Schema with Selective Expansion

选择性展开获取Schema

Expand only the parts of the schema you need:
bash
undefined
仅展开你需要的Schema部分:
bash
undefined

expand specific paths

expand specific paths

b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --expand-paths /products,/products/{productId}
b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --expand-paths /products,/products/{productId}

expand specific schemas

expand specific schemas

b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --expand-schemas Product,ProductResult
b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --expand-schemas Product,ProductResult

combine expansions

combine expansions

b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --expand-paths /products --expand-schemas Product
undefined
b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --expand-paths /products --expand-schemas Product
undefined

Get Full Schema

获取完整Schema

bash
undefined
bash
undefined

get full schema without any collapsing

get full schema without any collapsing

b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --expand-all
undefined
b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --expand-all
undefined

List Available Paths/Schemas/Examples

列出可用的路径/Schema/示例

Discover what's available in a schema before expanding:
bash
undefined
在展开Schema前先查询其中可用的内容:
bash
undefined

list all paths in the schema

list all paths in the schema

b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --list-paths
b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --list-paths

list all schema names

list all schema names

b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --list-schemas
b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --list-schemas

list all examples

list all examples

b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --list-examples
undefined
b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --list-examples
undefined

Output Formats

输出格式

bash
undefined
bash
undefined

output as YAML

output as YAML

b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --yaml
b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --yaml

output wrapped JSON with metadata (apiFamily, apiName, apiVersion, schema)

output wrapped JSON with metadata (apiFamily, apiName, apiVersion, schema)

b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --json
undefined
b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --json
undefined

Custom Properties

自定义属性

bash
undefined
bash
undefined

include custom properties (default behavior)

include custom properties (default behavior)

b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd
b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd

exclude custom properties

exclude custom properties

b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --no-expand-custom-properties
undefined
b2c scapi schemas get product shopper-products v1 --tenant-id zzxy_prd --no-expand-custom-properties
undefined

Configuration

配置

The tenant ID and short code can be set via environment variables:
  • SFCC_TENANT_ID
    : Tenant ID (e.g.,
    zzxy_prd
    , not the organization ID)
  • SFCC_SHORTCODE
    : SCAPI short code
你可以通过环境变量设置租户ID和短代码:
  • SFCC_TENANT_ID
    :租户ID(例如
    zzxy_prd
    ,不是组织ID)
  • SFCC_SHORTCODE
    :SCAPI短代码

More Commands

更多命令

See
b2c scapi schemas --help
for a full list of available commands and options.
执行
b2c scapi schemas --help
查看完整的可用命令和选项列表。