DEV Community

Alex Martinez
Alex Martinez

Posted on

Quick guide to applying MuleSoft's API Autodiscovery

Once you have created a Mule project and an API in API Manager, copy the API Instance ID from API Manager (8-digit number).

1. Add the API Autodiscovery Global Element

NOTE
You can add the API ID directly in the Global Element or as a property

Studio

In Studio, go to the Global Elements tab and click on New. Search for the Autodiscovery configuration. Add the API Instance ID from API Manager to the API ID field. Select the main flow from the dropdown.

ACB

This is not currently possible to be added from ACB.

2. Find your environment's client ID/Secret

In Anypoint Platform, go to Access Management > Business Groups > select your business group > Environments > Sandbox

Copy the Client ID and the Client Secret (click on Show)

3. Add your Anypoint Platform credentials locally

Studio

In Studio, open the Preferences and navigate to Anypoint Studio > API Manager. Under Environment Credentials, add your Client ID and Client Secret. Click on Validate > Apply and Close.

ACB

In VS Code, open the ACB tab and click on the ⚙️ icon to open ACB's settings. Go to Mule > Runtime: Default Arguments and append the following arguments at the end of the string.

-M-Danypoint.platform.client_id=your_client_id -M-Danypoint.platform.client_secret=your_client_secret
Enter fullscreen mode Exit fullscreen mode

4. Add your Anypoint Platform credentials in Runtime Manager

In your Mule app deployed to Runtime Manager, make sure you add your credentials to the properties tab.

anypoint.platform.client_id=your_client_id
anypoint.platform.client_secret=your_client_secret
Enter fullscreen mode Exit fullscreen mode

Set up Gatekeeper as needed

If you keep having a 503 error code being returned, it may mean the API ID you provided is not connected to an API Manager instance. If you want to get rid of it, set up anypoint.platform.gatekeeper=disabled in your runtime variables.

a) Studio: Set it up as an environment variable in your Run Configurations
b) ACB: Set it up as an argument following the -M-D... syntax from the previous point
c) CloudHub: Set it up as a property
d) Maven: Send it as a command argument

This setting may be a security concern, make sure you discuss this with your team before setting it up or read more about it in the following resources

Other resources

Top comments (0)