In the last exercise, we imported our serverless APIs into our API Management service. In this exercise, we will look at the API Management product concept.
An API Management Product is a way to organize and manage one or more APIs. You can include a number of APIs and offer them to developers (consumers of your APIs).
The benefits of using products include:
- Ability to package one or more APIs to your developers (consumers)
- Ability to create both products requiring subscriptions (Protected) and products which do not (Open)
- Ability to publish/unpublish products for general availability
- Ability to apply policy (such as usage quota), specify whether approval is required, legal terms at a product level when bundling APIs for business reasons
- Ability to control visibility and access to products within the API Management Developer Portal by associating to groups (applies only to dedicated API Management tiers only; not available in the Consumption tier)
- Navigate to your API Management instance in the Azure portal.
- Select Products section from the menu on the left.
- Click + Add to add a new product.
- Provide a Display name for the product, such as "Serverless APIs" (everything between the quotes).
- The Id field will be automatically populated if you've provided a Display name, however you can choose to override it if you wish.
- Enter a Description for the product.
- Since we are using the API Management Consumption tier which does not include a Developer Portal, the publishing state of our product has no effect and we can just leave the default Not published setting.
- By default, Requires subscription is checked. This means that in order for a consumer to call the API, they will need to provide a subscription key.
- Click Select API and check the API(s) you imported from the previous exercise. Click Select.
- Click Create to complete your new API Management product.
We need to create a subscription in order to call our API as part of this product. A subscription is a set of two keys for associated APIs. You need to provide one of the subscription keys when invoking a protected API by providing the key in the Ocp-Apim-Subscription-Key HTTP header.
Since we created our API Management product to require subscriptions, we now need to create a subscription to that product to generate an initial set of keys to use.
-
In your API Management instance in the Azure portal, select the Products section from the menu on the left.
-
Select the product you created from the previous section. This will take you to the product overview for that product.
-
Select the product Subscriptions menu option.
-
Click + Add Subscription to add a new subscription for the product.
-
Give the new subscription a Name (e.g. api-consumer-1) and a Display name (e.g. API Consumer 1).
-
Click Yes for Allow tracing.
-
Click Save.
-
At this point, you should see your new subscription listed for the product. To view the actual key values for the subscription, click on the ellipses ... and then Show/hide keys menu option.