创建和发布产品Create and publish a product

在 Azure API 管理中,产品包含一个或多个 API 以及使用配额和使用条款。In Azure API Management, a product contains one or more APIs as well as a usage quota and the terms of use. 一旦产品发布,开发人员便可以订阅该产品,并可开始使用该产品的 API。Once a product is published, developers can subscribe to the product and begin to use the product's APIs.

本教程介绍如何执行下列操作:In this tutorial, you learn how to:

  • 创建和发布产品Create and publish a product
  • 将 API 添加到产品Add an API to the product

添加产品教程

先决条件Prerequisites

创建和发布产品Create and publish a product

添加产品

  1. 单击左侧菜单中的“产品” 显示“产品” 页。Click on Products in the menu on the left to display the Products page.

  2. 单击“+ 添加”。 Click + Add.

    添加产品时,需要提供以下信息:When you add a product, you need to supply the following information:

    NameName 说明Description
    Display nameDisplay name 要在开发人员门户中显示的名称。The name as you want it to be shown in the Developer portal.
    NameName 产品的描述性名称。A descriptive name of the product.
    说明Description 可在“说明” 字段中提供有关该产品的详细的信息,例如其用途,它提供访问权的 API 和其他有用的信息。The Description field allows you to provide detailed information about the product such as its purpose, the APIs it provides access to, and other useful information.
    状态State 如果想要发布该产品,请按“发布”。 Press Published if you want to publish the product. 必须先发布产品,才能调用该产品中的 API。Before the APIs in a product can be called, the product must be published. 默认情况下新产品未发布,并仅对“管理员” 组可见。By default new products are unpublished, and are visible only to the Administrators group.
    需要订阅Requires subscription 如果需要用户订阅才能使用该产品,请选中“需要订阅” 。Check Require subscription if a user is required to subscribe to use the product.
    需要批准Requires approval 如果希望管理员审查并接受或拒绝此产品的订阅尝试,请选中“需要审批” 。Check Require approval if you want an administrator to review and accept or reject subscription attempts to this product. 如果未选中此框,则会自动批准订阅尝试。If the box is unchecked, subscription attempts are auto-approved.
    订阅计数限制Subscription count limit 若要限制多个同步订阅的计数,请输入订阅限制。To limit the count of multiple simultaneous subscriptions, enter the subscription limit.
    法律条款Legal terms 可以包含产品的使用条款,订阅者必须接受这些条款才能使用该产品。You can include the terms of use for the product which subscribers must accept in order to use the product.
    APIAPIs 产品是一个或多个 API 的关联。Products are associations of one or more APIs. 可以包含多个 API,并通过开发人员门户将其提供给开发人员。You can include a number of APIs and offer them to developers through the developer portal.
    可以在创建产品期间添加现有的 API。You can add an existing API during the product creation. 以后,可以通过产品的“设置”页上或者在创建 API 时将 API 添加到产品。 You can add an API to the product later, either from the Products Settings page or while creating an API.
  3. 单击“创建”创建新产品。 Click Create to create the new product.

添加更多配置Add more configurations

保存后,可以选择“设置”选项卡继续配置产品。 You can continue configuring the product after saving it by choosing the Settings tab.

通过“订阅”选项卡查看/添加产品的订阅者。 View/add subscribers to the product from the Subscriptions tab.

通过“访问控制” 选项卡为开发人员或来宾设置产品可见性。Set visibility of a product for developers or guest from the Access control tab.

将 API 添加到产品 Add APIs to a product

产品是一个或多个 API 的关联。Products are associations of one or more APIs. 可以包含多个 API,并通过开发人员门户将其提供给开发人员。You can include a number of APIs and offer them to developers through the developer portal. 可以在创建产品期间添加现有的 API。You can add an existing API during the product creation. 以后,可以通过产品的“设置”页上或者在创建 API 时将 API 添加到产品。 You can add an API to the product later, either from the Products Settings page or while creating an API.

开发人员必须先订阅产品才能访问 API。Developers must first subscribe to a product to get access to the API. 订阅时,他们会得到一个订阅密钥,此密钥对该产品中的任何 API 都有效。When they subscribe, they get a subscription key that is good for any API in that product. 如果你已创建 APIM 实例,则已成为管理员,因此,默认情况下已订阅每个产品。If you created the APIM instance, you are an administrator already, so you are subscribed to every product by default.

将 API 添加到现有产品Add an API to an existing product

添加产品 API

  1. 从“产品” 选项卡中选择一个产品。From the Products tab, select a product.
  2. 导航到 API 文件夹。Navigate to the APIs tab.
  3. 单击“+ 添加”。 Click + Add.
  4. 选择 API 并单击“选择”。 Choose an API and click Select.

Tip

可以通过 REST API 或 PowerShell 命令使用自定义订阅密钥来创建用户的订阅或将其更新为某个产品 。You can create or update user's subscription to a Product with custom subscription keys through REST API or PowerShell command.

后续步骤Next steps

在本教程中,你已学习了如何执行以下操作:In this tutorial, you learned how to:

  • 创建和发布产品Create and publish a product
  • 将 API 添加到产品Add an API to the product

转到下一教程:Advance to the next tutorial: