{{announcement.body}}
{{announcement.title}}

API Autodiscovery in Mule3

DZone 's Guide to

API Autodiscovery in Mule3

Find out what API Autodiscovery is and see how to create a sample API specification.

· Integration Zone ·
Free Resource

What Is API Autodiscovery?

We use API Autodiscovery to pair an API in API Manager to its deployed Mule application.

When autodiscovery is correctly configured in your Mule application, you can say that your application’s API is tracked by or paired to API Manager. Through the Autodiscovery scheme, the API Manager keeps track of the API throughout its lifecycle.

Only one API can be associated with one Autodiscovery instance.

Step 1: Create an API in the Design Center

Create a sample API specification:

Image title

Step 2: Test the API

Enable the Mocking service and test if it is working fine. If there are no issues, publish it to Exchange as an asset.

Step 3: Manage the API

Once the API is published in Exchange, Manage it in API Manager.

In the API Manager tab in Anypoint Platform, click on Manage API and select Manage API from Exchange.

Enter the API name. Select Managing type as Basic Endpoint.

Note: Do Not Check the box for the Mule version, as we are managing it in Mule3.

Once you save the configuration, the API will be visible in the API manager but the status of the API will be "UNREGISTERED".

It means that until now, it has not yet been associated with an actual implementation.

The most important thing to look out here is the Autodiscovery section, which has an API name and an API version.

Step 4: Create a Mule Project

After this, go to Anypoint Studio and create a Mule Project and import the newly created API from the design center. The necessary xml file will be generated with the flows inside it.

Step 5. Configuring Autodiscovery

(a) Click on the Global Elements on the canvas.

(b) Click Create and search for API Autodiscovery.

Image title

(c) In the Global Element Properties Window, set the API NAME, API Version, and Flow Name from the managed API in the API Manager.

Image title

Step 6: Testing and Deploying

Test the application to see if it is running fine without any errors.

Once the application is running successfully, deploy the application to cloudhub.

Step 7: Runtime Manager

In the Runtime Manager, set the application name and click the deploy application option.

Note: Make sure that your Anypoint Studio is set with the client id and client secret of your current account of Anypoint Platform.

Image title

Once the application is up and running, you can see the status of the API as active in the API manager.

Image title


Thank you!

Topics:
mule ,mule 4 ,api autodiscovery ,integration ,apis

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}