使用 product 命令

您可以使用 product 命令来获取和列出 Developer Portal 服务上的产品。

  1. 以提供者组织身份登录,如以下示例中所示。
    apic login --server management_server --realm provider/identity_provider --username provider_username --password provider_password
    通过输入以下命令查看所有可用身份提供者的列表(无需登录即可使用此命令),可以确定要在 --realm 参数中使用的身份提供者:
    apic identity-providers:list --scope provider --server platform_api_endpoint_url --fields title,realm
    例如
    apic identity-providers:list --scope provider --server platform_api_endpoint_url --fields title,realm 
    total_results: 2
    results:
      - title: API Manager User Registry
        realm: provider/default-idp-2
      - title: Corporate LDAP user registry
        realm: provider/corporate-ldap
    您可通过 title 值确定要使用的身份提供者;然后,可以直接从显示的 realm 值复制对应的 --realm 参数。 对于管理员在 API Connect 安装后创建的任何身份提供程序,其名称都是在创建时确定的。 用于以提供者组织成员身份登录的缺省 API Manager 本地用户注册表为 default-idp-2

    有关 apic login 命令的完整详细信息,请参阅 登录到管理服务器

    有关通用命令及其使用的摘要,请参阅 Developer Portal CLI 命令

  2. 从站点获取产品列表。

    例如
    apic --mode portaladmin product:list --org orgid/name --server management_server --catalog catalogid/name
    • management_server 是管理服务器的端点 URL (必填)。
    • catalogid/name 是站点所属目录的标识或名称 (必需)。
    • orgid/name 是目录所属的提供者组织的标识或名称 (必需)。
    • format_type 是输出格式。 可以是 jsonyamlgo-template=...go-template-file=...。 缺省值为 yaml
  3. 使用 idname:version从站点获取产品。

    例如
    apic --mode portaladmin product:get --org orgid/name --server management_server --catalog catalogid/name id/name:version
    • id/name:version -标识或名称: 特定产品的版本 (必需)。 例如, id-of-product-called-example-3example:3.0.0
  4. 使用 idname:version从提供的组织和目录的门户网站获取特定整个产品文档。
    apic --mode portaladmin product:get-document --org orgid/name --server management_server --catalog catalogid/name --format format_type  id/name:version
    
    例如
    apic --mode portaladmin product:get-document --org ibm --server my.management.server.com --catalog portal-test --format yaml  intuiz-product:1.0.0
    
  5. Developer Portal中添加产品附件。

    例如

    apic --mode portaladmin product:add-attachment -s management_server --org orgid/name --catalog catalogid/name --attachment_name attachment.txt --attachment_description "Product documentation" awesome-sleek-soft-chips-product:1.0.0 ./attachment.txt
    Loading File (Large files may take a while)...
    
    Attachment successfully added to product awesome-sleek-soft-chips-product:1.0.0.
      This product now has 2 attachments.
    
    • attachment_name 是上载附件时提供给该附件的名称 (必需)。
    • attachment_description 是对用户显示的附件的描述。
  6. Developer Portal中设置产品的图标。

    例如

    apic --mode portaladmin product:set-icon -s management_server --org orgid/name --catalog catalogid/name --icon_description "product icon" awesome-sleek-soft-chips-product:1.0.0 ./icon.png
    Loading File (Large files may take a while)...
    
    Icon successfully set for product awesome-sleek-soft-chips-product:1.0.0
    
    • icon_description 是要向用户显示的图标描述,它用作图像的备用文本 (必需)。
  7. Developer Portal中添加产品的标记 (类别)。

    例如

    apic --mode portaladmin product:add-tag -s management_server--org orgid/name --catalog catalogid/name --tag_name top_level_element/next_level_element/lower_level_element awesome-sleek-soft-chips-product:1.0.0
    Successfully set taxonomy tag top_level_element/next_level_element/lower_level_element
      for product api-connect-cassin-llc-awesome-sleek-soft-chips-product:1.0.0
    • tag_name 是标记名称。 例如, top_level_element/next_level_element (必需)。