API Proxy Auto Discovery

9
API PROXY AUTO DISCOVERY WITH MULESOFT API GATEWAY Vince Jason Soliza

Transcript of API Proxy Auto Discovery

Page 1: API Proxy Auto Discovery

API PROXY AUTO DISCOVERYWITH MULESOFT API GATEWAY

Vince Jason Soliza

Page 2: API Proxy Auto Discovery

Pre-requisites

• Anypoint Studio – Download it here https://www.mulesoft.com/platform/studio– Install Anypoint Studio plugin API gateway runtime 2.2.0

• API Proxy Project– http://www.slideshare.net/VinceSoliza/soap-to-rest-api-proxy

Page 3: API Proxy Auto Discovery

When do we need Auto-Discovery Functionality?

When building or modifying an API project in Anypoint Studio, it will be easy for the developers if the application is automatically discovered or registered in Anypoint Platform for APIs. For instance, having regular deployments of the same API, this will save the effort of typing the same information into the web application every time and reduce the risk of a human error to occur.

Page 4: API Proxy Auto Discovery

Where do we begin?• We begin from what we left off in our previous topic SOAP To REST API

Proxy. • Login to anypoint platform and then click the gear icon. • In the organization menu, select the organization to show the

organization info. Copy the organization client_id and client_secret.• See the API Status is currently unregistered.

Page 5: API Proxy Auto Discovery

Anypoint Studiowith API Gateway runtime• Link anypoint studio to our organization.• Open anypoint studio and go to preference.• Expand Anypoint Studio then select Anypoint Platform for API• Paste the client_id & secret then click validate.

Page 6: API Proxy Auto Discovery

Anypoint Studiowith API Gateway runtimeNow that we linked anypoint studio to our organization let’s add auto discovery in our configuration.• Open proxy.xml then click Configuration XML tab. Write this code just

above the flow.

<api-platform-gw:api id=“54233" apiName=“EchoRESTProxy" version=”1.0” flowRef="proxy" doc:name="API Autodiscovery”></api-platform-gw:api>xmlns:api-platform-gw=http://www.mulesoft.org/schema/mule/api-platform-gwhttp://www.mulesoft.org/schema/mule/api-platform-gwhttp://www.mulesoft.org/schema/mule/api-platform-gw/current/mule-api-platform-gw.xsd

Page 7: API Proxy Auto Discovery

Anypoint Studiowith API Gateway runtime• We can see through the logs that auto discovery is kicking inINFO 2016-02-22 11:14:15,302 [main] com.mulesoft.module.client.autodiscovery.AutoDiscoveryDeploymentListener: Source http://192.168.11.27:8081/api/echo/v1/* registered to API EchoRESTProxy [54233], version 1.0 [56227], org [a9d53ff2-1234-4a1f-8d1a-b19eb82612cc]

• See how it changed in API Manager. The API Status is now Active.

Page 8: API Proxy Auto Discovery

SummaryThe automatic discovery and registration of your API on the Anypoint Platform occurs when you deploy the applications to an API Gateway that is paired with your Anypoint Platform organization. While you can also register your APIs using the Anypoint Platform web application or its API, the API auto-discovery feature gives you an additional option for registering API endpoints quickly and efficiently. It’s particularly useful when you’re regularly deploying new versions of the same API, saving you from the effort of having to type the same information into the Web application every time and minimizing the risk of human error.https://docs.mulesoft.com/anypoint-platform-for-apis/api-auto-discovery

Page 9: API Proxy Auto Discovery

QUESTIONS?Please leave a comment