INTEGRATION USING MULE

API AutoDiscovery – Mule API Manager

Mule API Manager offers two different solutions to add a API Manager for an API.

  1. Endpoint with Proxy
  2. Basic Endpoint

In the first approach, Mule is essentially creating a new proxy application with logic to copy headers and forwarding traffic to configured API. The newly created proxy application is deployed in Mule Cloudhub which will consumer additional worker. This setup is needed if you want to hide your API from external user and also add API Manager features to the proxy.

Below is how it will look if you are using a proxy to an endpoint

While in the second approach, you are essentially just adding a Gateway component in front of your API which will directly interact with API Manager. In this, you are not hiding your API but just adding features of API Manager within your API. Since your API is already deploy in Cloudhub, API Manager will not consume additional worker as there is no proxy application needed.

API Gateway Configuration

Setting automatic creation of API Gateway will require your application to have API Auto discovery configuration so that API Manager can recognize and register.

Below is how the configuration looks for my sample application supporting API Auto Discovery:

Where, apiName is the name you would like to see on API Manager(not your actual api name)
version is the version on API Manager
flowRef is the flow you would like for API Manager to interact with. This should be your main flow
If you are using APIKit Router, then you will have to configure apikitRef=”your main flow with router”

Deploying via Anypoint Studio to CloudHub

If you are deploying your application via Anypoint Studio, make sure you have the Client Id and Client Secret configured in Anypoint Studio preferences

ClientId and ClientSecret can be found in anypoint platform portal, inside Access Management section –> Organization and clicking on the name of Organization/Business Group.

Manual/Automated Deployment to CloudHub

If you are deploying your application either manually or via a job which uploads to CloudHub, make sure to add below two properties in your application:

  1. anypoint.platform.client_id=your anypoint organization client id
  2. anypoint.platform.client_secret=your anypoint organization client secret

Once you have this setting and deploy the application in cloud, you should be able to see a new  application created within API Manager with the name and version configured in your flow.

Verify that your endpoint is configured correctly to the application you have pointed to. This can be done by clicking the version(1) –> Configure Endpoint withing API Status

At this point if you hit your api, you should be able to see analytics within API Manager.

Detailed steps of creating application, deploying and verifying this can be found at my video: https://www.youtube.com/watch?v=KDLtFLIdNKY