From 0376be2a0f993bca712ff2e992a32b5d9fcd427c Mon Sep 17 00:00:00 2001 From: Cristian Date: Tue, 5 May 2026 19:31:06 -0300 Subject: [PATCH] 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].