From 0376be2a0f993bca712ff2e992a32b5d9fcd427c Mon Sep 17 00:00:00 2001 From: Cristian Date: Tue, 5 May 2026 19:31:06 -0300 Subject: [PATCH 1/3] W-22217959-Add-API-autodiscovery-in-local-testing-CP --- modules/ROOT/nav.adoc | 1 + ...int-configure-api-autodiscovery-local.adoc | 67 +++++++++++++++++++ .../pages/int-developing-integrations.adoc | 1 + 3 files changed, 69 insertions(+) create mode 100644 modules/ROOT/pages/int-configure-api-autodiscovery-local.adoc diff --git a/modules/ROOT/nav.adoc b/modules/ROOT/nav.adoc index 31355c51a..222f80a6a 100644 --- a/modules/ROOT/nav.adoc +++ b/modules/ROOT/nav.adoc @@ -79,6 +79,7 @@ ** xref:int-manage-custom-metadata.adoc[] ** xref:int-debug-mule-apps.adoc[] ** xref:int-test-munit.adoc[] +** xref:int-configure-api-autodiscovery-local.adoc[] ** xref:int-autodiscovery-config.adoc[] ** xref:int-export-mule-project.adoc[] ** xref:int-import-mule-project.adoc[] diff --git a/modules/ROOT/pages/int-configure-api-autodiscovery-local.adoc b/modules/ROOT/pages/int-configure-api-autodiscovery-local.adoc new file mode 100644 index 000000000..dff94ac55 --- /dev/null +++ b/modules/ROOT/pages/int-configure-api-autodiscovery-local.adoc @@ -0,0 +1,67 @@ += Configure API Autodiscovery for Local Testing +:page-deployment-options: cloud-ide, desktop-ide + +include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] + +Configure *API Autodiscovery* to connect your local Mule application to an API instance in xref:api-manager::latest-overview-concept.adoc[API Manager]. This setup enables local policy testing before you deploy the application. + +== Before You Begin + +Ensure you have: + +* An active API instance in API Manager +* The xref:access-management::environments.adoc#to-view-the-client-id-and-client-secret-for-an-environment[client ID and client secret from Access Management] + +== Get the API ID + +. In Anypoint Platform, open *API Manager*. +. In *API Administration*, select your API instance. +. On the API summary page, copy the *API Instance ID*. + +== Add the Autodiscovery Element + +In your Mule app, add the autodiscovery element in your flow definitions: + +[source,xml] +---- + +---- + +== Configure Local Credentials + +For local execution in Anypoint Code Builder, provide your environment credentials through `config.yaml` or through your debug launch configuration. Avoid hardcoding secrets in Mule XML files. + +Set these properties: + +* `anypoint.platform.client_id` +* `anypoint.platform.client_secret` + +Example `config.yaml`: + +[source,yaml] +---- +anypoint.platform.client_id: "" +anypoint.platform.client_secret: "" +---- + +Example `launch.json` configuration: + +[source,json] +---- +{ + "configurations": [ + { + "name": "Debug Mule App", + "type": "java", + "request": "launch", + "mainClass": "org.mule.runtime.module.launcher.MuleContainer", + "args": [ + "-M-Danypoint.platform.client_id=", + "-M-Danypoint.platform.client_secret=" + ] + } + ] +} +---- + +You can also place the same values in the `env` section of `launch.json` if you prefer environment-variable-based credential handling. Keeping credentials in launch configuration helps prevent secrets from being committed to source files. diff --git a/modules/ROOT/pages/int-developing-integrations.adoc b/modules/ROOT/pages/int-developing-integrations.adoc index 4a38db901..bba22e608 100644 --- a/modules/ROOT/pages/int-developing-integrations.adoc +++ b/modules/ROOT/pages/int-developing-integrations.adoc @@ -23,6 +23,7 @@ After you xref:int-create-integrations.adoc[create your integration project], you can optionally: * xref:int-create-secure-configs.adoc[Define and secure properties for your Mule application]. +* xref:int-configure-api-autodiscovery-local.adoc[Configure API Autodiscovery for local testing]. * xref:int-trigger-flows.adoc[Trigger flows in your development environment]. * xref:int-use-dw-to-transform-data.adoc[Use the DataWeave language]. * xref:int-debug-mule-apps.adoc[Debug Mule apps]. From 4c824d896265c577f3bee6a2f78c4dadc531386e Mon Sep 17 00:00:00 2001 From: Cristian Date: Tue, 12 May 2026 16:46:56 -0300 Subject: [PATCH 2/3] W-22217959-Address-William-feedback-CP --- ...int-configure-api-autodiscovery-local.adoc | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/modules/ROOT/pages/int-configure-api-autodiscovery-local.adoc b/modules/ROOT/pages/int-configure-api-autodiscovery-local.adoc index dff94ac55..4bf0483bf 100644 --- a/modules/ROOT/pages/int-configure-api-autodiscovery-local.adoc +++ b/modules/ROOT/pages/int-configure-api-autodiscovery-local.adoc @@ -29,7 +29,7 @@ In your Mule app, add the autodiscovery element in your flow definitions: == Configure Local Credentials -For local execution in Anypoint Code Builder, provide your environment credentials through `config.yaml` or through your debug launch configuration. Avoid hardcoding secrets in Mule XML files. +For local execution in Anypoint Code Builder, provide your environment credentials through `config.yaml` or through Mule runtime arguments in VS Code settings. Avoid hardcoding secrets in Mule XML files. Set these properties: @@ -44,24 +44,18 @@ anypoint.platform.client_id: "" anypoint.platform.client_secret: "" ---- -Example `launch.json` configuration: +Example Mule runtime arguments: -[source,json] +[source,text] ---- -{ - "configurations": [ - { - "name": "Debug Mule App", - "type": "java", - "request": "launch", - "mainClass": "org.mule.runtime.module.launcher.MuleContainer", - "args": [ - "-M-Danypoint.platform.client_id=", - "-M-Danypoint.platform.client_secret=" - ] - } - ] -} +-M-Danypoint.platform.client_id= -M-Danypoint.platform.client_secret= ---- -You can also place the same values in the `env` section of `launch.json` if you prefer environment-variable-based credential handling. Keeping credentials in launch configuration helps prevent secrets from being committed to source files. +To add these values in Anypoint Code Builder: + +. Open the *Settings* tab. +include::reuse::partial$acb-reusable-steps.adoc[tags="mule-settings-nav-options"] +. In the *Settings* tab, find *Mule › Runtime: Default Arguments*. +. Append the client ID and client secret arguments to the end of the existing arguments. + +Replace the placeholder values with your client ID and client secret. From 60e4d3297b2dfd60566fb619fc2f0cde5e02133d Mon Sep 17 00:00:00 2001 From: Cristian Date: Wed, 13 May 2026 15:32:36 -0300 Subject: [PATCH 3/3] W-22217959-Address-William-feedback-CP --- .../ROOT/pages/int-configure-api-autodiscovery-local.adoc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/ROOT/pages/int-configure-api-autodiscovery-local.adoc b/modules/ROOT/pages/int-configure-api-autodiscovery-local.adoc index 4bf0483bf..dd67c8ee1 100644 --- a/modules/ROOT/pages/int-configure-api-autodiscovery-local.adoc +++ b/modules/ROOT/pages/int-configure-api-autodiscovery-local.adoc @@ -20,11 +20,11 @@ Ensure you have: == Add the Autodiscovery Element -In your Mule app, add the autodiscovery element in your flow definitions: +In your Mule app, add the autodiscovery element in your flow definitions. Use a property reference for `apiId` so you can load the value through configuration: [source,xml] ---- - + ---- == Configure Local Credentials @@ -40,6 +40,7 @@ Example `config.yaml`: [source,yaml] ---- +api.instance.id: "" anypoint.platform.client_id: "" anypoint.platform.client_secret: "" ---- @@ -58,4 +59,4 @@ include::reuse::partial$acb-reusable-steps.adoc[tags="mule-settings-nav-options" . In the *Settings* tab, find *Mule › Runtime: Default Arguments*. . Append the client ID and client secret arguments to the end of the existing arguments. -Replace the placeholder values with your client ID and client secret. +Append the placeholder values with your client ID and client secret.