Creating Azure API Management Service Instance and Importing Backend APIs

Creating Azure API Management Service Instance and Importing Backend APIs

Prerequisites

  • Azure Subscription

Introduction: Azure API Management

In this digital era, businesses everywhere are looking into a way of extending their operations as a digital platform, creating new channels, integrating with multiple platforms and achieve a developer friendly ecosystem.

API Management (APIM) provides a robust method to ensure a successful API program through developer engagement, business insights, analytics, security and protection. Azure API Management service helps developers and organisations a robust means to publish their APIs to external world (partners, customers/end-users) with ease and speed.

The below figure (Figure.1) depicts a pictorial view of a developer who subscribed to APIM product, accessing the product’s associated API (APIs are hosted by internal backend service) via APIM Service using API gateway endpoint.

APIM_v1.JPG Figure.1: Azure API Management Service Overview

Create an Azure API Management (APIM) instance using Azure portal

To create an APIM service, login to https://portal.azure.com

Step 1. Once signed-in, search for APIM service as showed below

1.JPG

Step 2. In APIM service page, click on the “Create” option 2.JPG

Step3. In create section, enter all the required fields to create a new APIM service

  • Resource Group: Select existing or a create new resource group

  • Region: Azure region in which the APIM service will be spawned

  • Resource Name: API Management instance name

  • Organization Name: To use in developer portal and sending email notifications

  • Administrator email: To receive all system notifications from APIM

3.jpg

4.jpg

In this article, the pricing tier is selected as “Developer”. The Developer tier of API Management does not include SLA and should not be used for production purposes. Your service may experience intermittent outages, for example during upgrades.

Note: Apart from Basics section, all other sections (Monitoring, Scale, Managed Identity, Virtual Network, Protocol Settings, Tags) are left to default values in this article

Step4. Click on Review + Create and once the validation passed, click on Create button to proceed for APIM service creation

5.jpg

Step5. Once the creation of APIM service is successful, navigate to the newly created APIM service

6.jpg

Import and publish backend APIs

Step6. Navigate to the newly created service labs-demo and click on API option from the left blade

7.jpg

Step7. To import APIs, click on Add API and select OpenAPI under Create from definition

8.jpg

Step8. In OpenAPI specification, enter details as follows

  • OpenAPI Specification: In this article, Microsoft provided backend APIs sample is used (https://conferenceapi.azurewebsites.net?format=json). The API specification can be added as an endpoint URL or uploaded as a file

  • Enter Display name, Name, description

  • URL scheme: Select HTTP or HTTPS or Both. For production, HTTPS is recommended

  • API URL Prefix: A suffix appended to the base URL of the API Management service. The suffix must be unique for every API for a given publisher

  • Tags: Organising APIs for grouping, searching and filtering

  • Products: To associate APIs to a product. By default, APIM instance comes with two products. Here, a default product Starter is used to associate the APIs to publish

  • Gateway: To expose the API. This field is available only in Developer and Premium tier services

  • Version: To version the APIs

9.jpg

10.jpg

11.jpg

Step9. Once created, the endpoints can be viewed under API section in the name Demo Conference API

12.jpg

Step10. Now, test the APIs from APIM by navigating to Test tab,

Step 10.1. Select the API to test (Here, GetSpeaker endpoint is taken for testing)

Step 10.2. Input the required input parameters (Speaker ID)

Step 10.3. Click Send and observe the response from the backend API (200 OK)

13.jpg

Note: To publish the API to API consumers, this must be associate with a product and while sending the request to API, subscription key (Ocp-Apim-Subscription-Key) needs to be passed in the header. The need to send Ocp-Apim-Subscription-Key as a header for each request can be enabled/disabled at the Settings tab

14.jpg

Accessing the backend APIs using API gateway endpoint using POSTMAN tool.

Note: The API gateway URL can be obtained from the overview section of APIM service instance

15.jpg

References