Creating a proxy REST API with IBM API Management 4.0. to create a REST API...آ  Creating a proxy...

download Creating a proxy REST API with IBM API Management 4.0. to create a REST API...آ  Creating a proxy REST

If you can't read please download the document

  • date post

    25-Jun-2020
  • Category

    Documents

  • view

    0
  • download

    0

Embed Size (px)

Transcript of Creating a proxy REST API with IBM API Management 4.0. to create a REST API...آ  Creating a proxy...

  • Creating a proxy REST API with IBM API Management 4.0.0.0 April 29, 2015

    Creating a proxy REST API with

    IBM API Management 4.0.0.0

    © 2015 Copyright IBM Corporation 1 of 23

  • Creating a proxy REST API with IBM API Management 4.0.0.0 April 29, 2015

    TABLE OF CONTENTS

    OBJECTIVE .................................................................................................................................... 3

    CASE STUDY ................................................................................................................................. 3

    USER ROLES ................................................................................................................................. 3

    BEFORE YOU BEGIN .................................................................................................................... 5

    LOG INTO THE API MANAGER .................................................................................................... 6

    CREATE A LOANS REST API ....................................................................................................... 7

    CREATE A LOAN QUOTE PROXY RESOURCE .......................................................................... 9

    CREATE A PLAN ......................................................................................................................... 15

    TEST THE LOAN QUOTE RESOURCE ...................................................................................... 19

    SUMMARY .................................................................................................................................... 22

    © 2015 Copyright IBM Corporation 2 of 23

  • Creating a proxy REST API with IBM API Management 4.0.0.0 April 29, 2015

    Objective This is the first tutorial in a series which will teach you to use IBM API Management 4.0.0.0 to create and test a number of different APIs. As this is the first in the series it covers the creation of a plan which is required for the following tutorials.

    In this tutorial you will learn:  How to create a REST API which proxies an existing REST endpoint  How to create a Plan and add a Resource to it  How to test a REST API using the integrated test tool

    Case study Bank A has an existing set of REST based services that they would like to expose through APIs in order to foster growth within the mobile and device market. The Bank A business team knows that an increased mobile and device application presence will enhance their brand image and increase customer satisfaction.

    After considering building their own API management solution, the Bank A technology team has decided to implement an IBM API Management solution as it will allow them to enter the market quickly at a reduced cost.

    In this tutorial you will develop the Bank A API Management solution. The solution will include the documentation and definition of a pure proxy to access the loan quote REST service as shown in Figure 1 below. This simple proxy allows Bank A to monitor the use of the service and restrict access to the API.

    Figure 1 - Loan Quote REST Proxy

    © 2015 Copyright IBM Corporation 3 of 23

  • Creating a proxy REST API with IBM API Management 4.0.0.0 April 29, 2015

    User roles IBM API Management v4 allows different roles to be assigned to users. For more details of the different user roles and descriptions of them please see the following page in the Knowledge Center:

    Adding users and assigning roles

    This tutorial has been written assuming that you are an Administrator or Organization Owner. If you are another role, such as Product Manager or Developer then some of the required functionality will not be available to you so you may need to contact an Administrator or Organization Owner to perform certain actions.

    © 2015 Copyright IBM Corporation 4 of 23

    http://www-01.ibm.com/support/knowledgecenter/SSWHYP_4.0.0/com.ibm.apimgmt.apionprem.doc/task_apionprem_managing_users.html

  • Creating a proxy REST API with IBM API Management 4.0.0.0 April 29, 2015

    Before you begin Access the Bank A Backend Service Before you setup an API in the IBM API Management product, you need to verify that the backend loan quote service is working and accessible. Remember that the goal is to expose this service as a managed API on the IBM API Management platform.

    1. Open a new browser tab and navigate to the URL http://banka.mybluemix.net/home/index.html

    2. Click on the example URI endpoint for the service titled Loan Service (JSON) to make sure that the loan quote service is operational. This is the service that you would like to expose via the API gateway. By clicking on the link you are making a REST based GET call to the loan quote service, passing the query parameters in the URL.

    NOTE: Keep the Loan Service browser tab open for later in the tutorial as you will need some information from it. © 2015 Copyright IBM Corporation 5 of 23

    http://banka.mybluemix.net/home/index.html

  • Creating a proxy REST API with IBM API Management 4.0.0.0 April 29, 2015

    Log into the API Manager 3. Open a new browser tab and navigate to the URL

    https:///apimanager Where is the IP Address or hostname of your management server.

    4. Sign in to the IBM API Management platform by entering your credentials and clicking Sign in.

    5. After you sign in, the API Manager Home page is displayed. The home screen displays activity graphs for the most active APIs and Applications.

    6. At the top of the screen, the primary banner contains a drop down list for your organizations (highlighted in red below) and your login name. You must belong to an organization to use the API Manager UI.

    © 2015 Copyright IBM Corporation 6 of 23

    https://managementnode/apimanager/ https://managementnode/apimanager/

  • Creating a proxy REST API with IBM API Management 4.0.0.0 April 29, 2015

    Create a Loans REST API Now that you have logged into the API Manager, you can start creating a REST API to expose and manage Bank A’s loan quote service.

    7. Select APIs from the navigation pane. This will take you in to the Draft APIs view, from here you can compose an API or import a Swagger or WSDL API.

    8. Click the + API button and select Compose.

    © 2015 Copyright IBM Corporation 7 of 23

  • Creating a proxy REST API with IBM API Management 4.0.0.0 April 29, 2015

    9. Populate the fields as shown in the table below. When complete, click the Add button. This will add the API to the Draft APIs list.

    Field Name Value

    API name Loans Path /loans/v1 API description Operations related to Bank A loans

    Note: The Path specified here will become part of the URL which is eventually called so will need to be valid for this use.

    © 2015 Copyright IBM Corporation 8 of 23

  • Creating a proxy REST API with IBM API Management 4.0.0.0 April 29, 2015

    Create a Loan Quote Proxy Resource 10.Click on the Loans link to define the specific resources that are available for the API.

    11. Review the Loans REST API Security configuration, Click Security.

    © 2015 Copyright IBM Corporation 9 of 23

  • Creating a proxy REST API with IBM API Management 4.0.0.0 April 29, 2015

    12.The API identification and authentication requirements are displayed beneath the titles "Identify Application Using" and "Authenticate Application Users Using". You can also upload or link to external documentation for the API.

    Check that Identify Application Using is set to Client ID.

    13.Switch to the Resources configuration panel. Click Resources.

    14.To create a single quote resource that supports a GET operation, click + Resource.

    © 2015 Copyright IBM Corporation 10 of 23

  • Creating a proxy REST API with IBM API Management 4.0.0.0 April 29, 2015

    15.By default, the HTTP methods GET and POST are displayed. Remove the POST method by clicking the X inside of the Post button

    16.Populate the fields as shown in the table below. Check that Identification is selected for this resource. When complete, click the Add button.

    Field Name Value

    Path /quote?loanAmount=20000&annualInterestRate=0.9&termInMonths=52 Display Name

    Quote

    Description Loan quote

    17.Now t