DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Create Proxy Application for Mule APIs
  • Create Custom DataWeave Functions in Mule 4
  • Managing Dynamic Application Properties in MuleSoft for CloudHub Applications
  • Configuring Okta as a Client Provider in MuleSoft Anypoint Platform

Trending

  • The Hidden Cost of Overprivileged Tokens: Designing Messaging Platforms That Assume Compromise
  • The ORM Is Over: AI-Written SQL Is the New Data Access Layer
  • Dear Micromanager: Your Distrust Has a Job; It’s Just Not the One You’re Doing
  • AI Agents in Java: Architecting Intelligent Health Data Systems
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Implementing API Auto-Discovery for MuleSoft Application Deployed to CloudHub and On-Premise

Implementing API Auto-Discovery for MuleSoft Application Deployed to CloudHub and On-Premise

By 
Jitendra Bafna user avatar
Jitendra Bafna
·
Apr. 02, 20 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
21.4K Views

Join the DZone community and get the full member experience.

Join For Free

Introduction

API Auto-Discovery is a mechanism that manages an API from API Manager by pairing the deployed application to an API created on the platform. API Management includes tracking, enforcing policies if you apply any, and reporting API analytics. Critical to the auto-discovery process is identifying the API by providing the API name and version.

Prerequisites

To configure auto-discovery for your Mule application, you need to meet the following requirements:

  • API must exist in API Manager and configured with either a basic endpoint or a proxy endpoint.
  • Mule must be configured to use AnyPoint Platform credentials.
  • The auto-discovery element must be configured in your Mule application. This XML element must point to the specific API in the API manager that you want to pair to.
  • You need an environment client_id and client_secret. You can get a client_id and client_secret from the AnyPoint Platform.

Configuring API Manager

To achieve API Auto-Discovery, you need to configure the API Manager. You can login to the AnyPoint Platform and navigate to API Manager to Manage API from Exchange and select your RAML.

API admin sandbox

API admin sandbox

Select Managing type as Basic Endpoint and check on "Check this box if you are managing this API in Mule 4 or above". Then, click Save.

Once you can click on Save, it will give you an API Instance Id, and that will be used for API Auto-Discovery. You will be requiring this API Instance Id to configure your application.

By default, API status is Unregistered. It will become Active, once we deploy an application to the Runtime Manager.

Getting API Instance ID

Getting API Instance ID

Configuring MuleSoft Application to Enable API Auto-Discovery

You need to add an API Auto-Discovery component in your application using the AnyPoint Platform.

Component configurations

Component configurations

This can be done using a Global configuration of your application. Then, configure your API Auto-Discovery component.

Configuring API Auto-Discovery

Configuring API Auto-Discovery

Provide the API Id that you got while configuring API Manager with the Basic Endpoint.

You need to make sure that the below four properties added to your properties file; otherwise API Auto-Discovery will not work.

Properties files
xxxxxxxxxx
1
 
1
anypoint.platform.analytics_base_uri=https://analytics-ingest.anypoint.mulesoft.com/
2
anypoint.platform.client_id=89ce5363a43d45809dbd56782b9a73195
3
anypoint.platform.client_secret=CD7DA80C15dB4Db9b77B27EF05344
4
anypoint.platform.base_uri=https://anypoint.mulesoft.com/


You can get Client Id and Client Secret from the AnyPoint Platform (Access Management ==> Environments).

Adding Client Id and Secret

Adding Client Id and Secret

After configuring API Auto-Discovery and properties, you need to run the application using AnyPoint Studio and API will become Active in API Manager.

Even once you deploy an application to MuleSoft CloudHub Runtime Manager or MuleSoft On-Premise Runtime, API will be Active in the API Manager.

API Auto-Discovery gives the advantages of applying various policies for your application deployed to CloudHub or on-premise. With this, you can avoid creating proxy applications.

API status: active

API status: active


This is how you can implement API Auto-Discovery for your MuleSoft Application.

API application MuleSoft

Opinions expressed by DZone contributors are their own.

Related

  • Create Proxy Application for Mule APIs
  • Create Custom DataWeave Functions in Mule 4
  • Managing Dynamic Application Properties in MuleSoft for CloudHub Applications
  • Configuring Okta as a Client Provider in MuleSoft Anypoint Platform

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook