Logo

dev-resources.site

for different kinds of informations.

Quick guide to applying MuleSoft's API Autodiscovery

Published at
2/16/2024
Categories
mulesoft
security
api
anypoint
Author
devalexmartinez
Categories
4 categories in total
mulesoft
open
security
open
api
open
anypoint
open
Author
15 person written this
devalexmartinez
open
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

In ACB, go to the XML view and start writing autodiscovery. Select the api-gateway:autodiscovery snippet. Add the API Instance ID from API Manager to the apiId field. Write the main flow on flowRef.

2. Find your environment's client ID/Secret

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

Note: See more ways to retrieve this info here.

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 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

Add your credentials to the properties tab in your Mule app deployed to Runtime Manager.

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 - this will disable the connection to API Manager

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

mulesoft Article's
30 articles in total
Favicon
Top Use Cases of MuleSoft API Manager
Favicon
List of AsyncAPI servers in MuleSoft
Favicon
Comparison Of Boomi And Mulesoft: Choosing The Right Integration Platform
Favicon
MuleSoft RPA Basics: From Start to Finish
Favicon
Quick fix: com.github.everit-org.json-schema:org.everit.json.schema:jar:1.12.2 was not found
Favicon
The Ultimate Guide to Mastering MuleSoft: Elevate Your Integration Skills
Favicon
How to Improve Productivity with MuleSoft RPA Integration
Favicon
Integration Digest: March 2024
Favicon
4 ways to retrieve your OrgID/groupID from Anypoint Platform
Favicon
An interesting Mule app to create complex MUnits
Favicon
Methods for Handling Null Values in DataWeave
Favicon
Quick guide to applying MuleSoft's API Autodiscovery
Favicon
Quick guide to secure/encrypt your properties in MuleSoft
Favicon
Integration Digest: October 2023
Favicon
Integration Digest: November 2023
Favicon
mTLS in CloudHub 2.0 : What Developers Need to Know
Favicon
Harnessing the power of MuleSoft and Hasura
Favicon
How to Set HTTP Error Responses in MUnit Testing
Favicon
Quick reference: CI/CD for a Mule app using a Connected App
Favicon
Mastering RAML Resource Naming: Best Practices for a MuleSoft Marvel! 💻🚀
Favicon
Leverage Exchange Mocking Service with Mocking Service Proxy
Favicon
Best Mulesoft Service Providers
Favicon
Using time() and duration() in DataWeave for performance check
Favicon
Deploying MuleSoft Application to Cloudhub 2.0 using Azure DevOps - Part 2
Favicon
Deploying MuleSoft Application to Cloudhub 2.0 using Azure DevOps - Part 1
Favicon
Main difference between 'do' and 'using' operators in DataWeave
Favicon
Develop your Battlesnake using a MuleSoft API & DataWeave with this starter project
Favicon
How to generate shareable link examples from GitHub to open in the DataWeave Playground
Favicon
Custom Alerts and Notifications in CloudHub 2.0
Favicon
Read this book to get started with MuleSoft! Especially if you come from a Salesforce background

Featured ones: