<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Martina Huzanic on Medium]]></title>
        <description><![CDATA[Stories by Martina Huzanic on Medium]]></description>
        <link>https://medium.com/@martinahuzanic?source=rss-5a200f51912e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IiKrx9VHx0ynDmQQoFm7GA.jpeg</url>
            <title>Stories by Martina Huzanic on Medium</title>
            <link>https://medium.com/@martinahuzanic?source=rss-5a200f51912e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 16:34:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@martinahuzanic/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Mastering DataWeave: Transforming Nested Customer Data]]></title>
            <link>https://medium.com/another-integration-blog/mastering-dataweave-transforming-nested-customer-data-f36d108563ca?source=rss-5a200f51912e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f36d108563ca</guid>
            <dc:creator><![CDATA[Martina Huzanic]]></dc:creator>
            <pubDate>Tue, 24 Nov 2026 20:35:21 GMT</pubDate>
            <atom:updated>2026-11-24T20:35:21.512Z</atom:updated>
            <content:encoded><![CDATA[<p>How to transform a nested customer data object using DataWeave.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*_JaRshZiVghyxIIhFjBk0Q.png" /></figure><p>In this article, we’ll explore how to transform a nested customer data object using DataWeave, focusing on extracting and restructuring key information for practical applications.</p><p><strong>Understanding the Data Structure</strong></p><p>Our input is a JSON object representing a customer’s profile, order history, and support tickets.</p><pre>INPUT PAYLOAD<br><br>{<br>  &quot;user&quot;: {<br>    &quot;id&quot;: 12345,<br>    &quot;firstName&quot;: &quot;Martina&quot;,<br>    &quot;lastName&quot;: &quot;Huzanic&quot;,<br>    &quot;email&quot;: &quot;huzz@example.com&quot;,<br>    &quot;profile&quot;: {<br>      &quot;dob&quot;: &quot;1997-11-16&quot;,<br>      &quot;gender&quot;: &quot;Female&quot;,<br>      &quot;preferences&quot;: {<br>        &quot;notifications&quot;: {<br>          &quot;email&quot;: true,<br>          &quot;sms&quot;: false,<br>          &quot;push&quot;: true<br>        },<br>        &quot;theme&quot;: &quot;dark&quot;,<br>        &quot;languages&quot;: [&quot;English&quot;, &quot;Spanish&quot;, &quot;French&quot;]<br>      }<br>    },<br>    &quot;roles&quot;: [&quot;admin&quot;, &quot;editor&quot;],<br>    &quot;createdAt&quot;: &quot;2024-02-25T14:30:00Z&quot;<br>  },<br>  &quot;orders&quot;: [<br>    {<br>      &quot;orderId&quot;: &quot;ORD001&quot;,<br>      &quot;date&quot;: &quot;2024-02-20&quot;,<br>      &quot;items&quot;: [<br>        {<br>          &quot;productId&quot;: &quot;P123&quot;,<br>          &quot;name&quot;: &quot;Laptop&quot;,<br>          &quot;quantity&quot;: 1,<br>          &quot;price&quot;: 999.99,<br>          &quot;specs&quot;: {<br>            &quot;RAM&quot;: &quot;16GB&quot;,<br>            &quot;Storage&quot;: &quot;512GB SSD&quot;,<br>            &quot;Processor&quot;: &quot;Intel i7&quot;<br>          }<br>        },<br>        {<br>          &quot;productId&quot;: &quot;P456&quot;,<br>          &quot;name&quot;: &quot;Wireless Mouse&quot;,<br>          &quot;quantity&quot;: 2,<br>          &quot;price&quot;: 29.99<br>        }<br>      ],<br>      &quot;status&quot;: &quot;shipped&quot;,<br>      &quot;totalAmount&quot;: 1059.97,<br>      &quot;payment&quot;: {<br>        &quot;method&quot;: &quot;Credit Card&quot;,<br>        &quot;transactionId&quot;: &quot;TXN789456&quot;<br>      }<br>    },<br>    {<br>      &quot;orderId&quot;: &quot;ORD002&quot;,<br>      &quot;date&quot;: &quot;2024-02-22&quot;,<br>      &quot;items&quot;: [<br>        {<br>          &quot;productId&quot;: &quot;P789&quot;,<br>          &quot;name&quot;: &quot;Mechanical Keyboard&quot;,<br>          &quot;quantity&quot;: 1,<br>          &quot;price&quot;: 129.99<br>        }<br>      ],<br>      &quot;status&quot;: &quot;processing&quot;,<br>      &quot;totalAmount&quot;: 129.99,<br>      &quot;payment&quot;: {<br>        &quot;method&quot;: &quot;PayPal&quot;,<br>        &quot;transactionId&quot;: &quot;TXN123654&quot;<br>      }<br>    }<br>  ],<br>  &quot;supportTickets&quot;: [<br>    {<br>      &quot;ticketId&quot;: &quot;TKT001&quot;,<br>      &quot;createdAt&quot;: &quot;2024-02-23T10:15:00Z&quot;,<br>      &quot;status&quot;: &quot;open&quot;,<br>      &quot;category&quot;: &quot;Technical Issue&quot;,<br>      &quot;messages&quot;: [<br>        {<br>          &quot;from&quot;: &quot;user&quot;,<br>          &quot;timestamp&quot;: &quot;2024-02-23T10:16:00Z&quot;,<br>          &quot;message&quot;: &quot;My laptop is not turning on.&quot;<br>        },<br>        {<br>          &quot;from&quot;: &quot;support&quot;,<br>          &quot;timestamp&quot;: &quot;2024-02-23T11:00:00Z&quot;,<br>          &quot;message&quot;: &quot;Have you tried plugging it in and holding the power button?&quot;<br>        }<br>      ]<br>    }<br>  ]<br>}</pre><p>For output we need a structured payload containing all necessary information to ensure a successful purchase. So, my desired output is next :</p><pre>OUTPUT PAYLOAD<br><br>{<br>  &quot;Customer&quot;: {<br>    &quot;Id&quot;: 12345,<br>    &quot;Name&quot;: &quot;Martina Huzanic&quot;,<br>    &quot;Age&quot;: 27,<br>    &quot;Email&quot;: &quot;huzz@example.com&quot;,<br>    &quot;Permissions&quot;: &quot;admin, editor&quot;<br>  },<br>  &quot;OrderSummary&quot;: [<br>    {<br>      &quot;Order&quot;: &quot;ORD001&quot;,<br>      &quot;Article&quot;: &quot;Laptop&quot;,<br>      &quot;Status&quot;: &quot;shipped&quot;,<br>      &quot;Total&quot;: &quot;1059.97 EUR&quot;<br>    },<br>    {<br>      &quot;Order&quot;: &quot;ORD002&quot;,<br>      &quot;Article&quot;: &quot;Wireless Mouse&quot;,<br>      &quot;Status&quot;: &quot;processing&quot;,<br>      &quot;Total&quot;: &quot;129.99 EUR&quot;<br>    }<br>  ],<br>  &quot;SupportTicket&quot;: [<br>    {<br>      &quot;Ticket&quot;: &quot;TKT001&quot;,<br>      &quot;Status&quot;: &quot;open since 23-02-2024&quot;,<br>      &quot;Category&quot;: &quot;Technical Issue&quot;,<br>      &quot;Message&quot;: &quot;My laptop is not turning on.&quot;<br>    }<br>  ]<br>}</pre><ol><li>We will start by defining headers and imports (import * from dw::core::Strings → actually imports all functions from the Strings module, allowing operations like splitBy and joinBy)</li><li>Next step is defining variables</li></ol><pre>%dw 2.0<br>import * from dw::core::Strings<br>// Function to calculate age from date string in DD-MM-YYYY format<br>fun calculateAge(birthDate: String) = do {<br>    var parts = birthDate splitBy &quot;-&quot;<br>    var formattedDate = parts[2] ++ &quot;-&quot; ++ parts[1] ++ &quot;-&quot; ++ parts[0]<br>    var birthDateTime = formattedDate as Date {format: &quot;yyyy-MM-dd&quot;}<br>    var currentDate = now() as Date<br>    var age = currentDate.year - birthDateTime.year - <br>        (if ((currentDate.month &lt; birthDateTime.month) or <br>            (currentDate.month == birthDateTime.month and currentDate.dayOfMonth &lt; birthDateTime.dayOfMonth))<br>         1 else 0)<br>    ---<br>    age<br>}<br>// Function to format date from ISO to DD-MM-YYYY<br>fun formatDate(dateString: String) = do {<br>    var date = dateString as DateTime<br>    ---<br>    date as String {format: &quot;dd-MM-yyyy&quot;}<br>}<br>output application/json<br>---<br>{<br>    Customer: {<br>        Id: payload.user.id,<br>        // Concatenate first and last name with space<br>        Name: payload.user.&quot;first name&quot; ++ &quot; &quot; ++ payload.user.&quot;last name&quot;,<br>        // Calculate age from date of birth<br>        Age: calculateAge(payload.user.profile.&quot;date of birth&quot;),<br>        Email: payload.user.email,<br>        // Convert roles array to comma-space-separated string<br>        Permissions: payload.user.roles joinBy &quot;, &quot;<br>    },<br>    // Transform orders array<br>    OrderSummary: [<br>        {<br>            Order: payload.orders[0].orderId,<br>            Article: payload.orders[0].items[0].name,<br>            Status: payload.orders[0].status,<br>            Total: payload.orders[0].totalAmount as String ++ &quot; EUR&quot;<br>        },<br>        {<br>            Order: payload.orders[1].orderId,<br>            // Take second item from first order as per business rule<br>            Article: payload.orders[0].items[1].name,<br>            Status: payload.orders[1].status,<br>            Total: payload.orders[1].totalAmount as String ++ &quot; EUR&quot;<br>        }<br>    ],<br>    SupportTicket: payload.supportTickets map {<br>        Ticket: $.ticketId,<br>        // Concatenate status with formatted date<br>        Status: &quot;open since &quot; ++ formatDate($.createdAt),<br>        Category: $.category,<br>        // Get first user message<br>        Message: ($.messages filter ($.from == &quot;user&quot;))[0].message<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f36d108563ca" width="1" height="1" alt=""><hr><p><a href="https://medium.com/another-integration-blog/mastering-dataweave-transforming-nested-customer-data-f36d108563ca">Mastering DataWeave: Transforming Nested Customer Data</a> was originally published in <a href="https://medium.com/another-integration-blog">Another Integration Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Batch APIs to CloudHub 2.0]]></title>
            <link>https://medium.com/another-integration-blog/deploying-batch-apis-to-cloudhub-2-0-16ae35acd3fa?source=rss-5a200f51912e------2</link>
            <guid isPermaLink="false">https://medium.com/p/16ae35acd3fa</guid>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[batch-processing]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[mulesoft]]></category>
            <dc:creator><![CDATA[Martina Huzanic]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 10:56:01 GMT</pubDate>
            <atom:updated>2026-11-24T20:35:41.946Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>What You Need to Know?</strong></h4><h4>Can Batch APIs Coexist with CloudHub 1.0?</h4><p><strong>Yes — but not on the same application.</strong></p><p>A single application runs on either CH1 or CH2, never both.</p><p>However, you can run some apps on CH1 and others on CH2 in the same Anypoint organization without conflict. The runtimes are isolated: different infrastructure, different schedulers, different notification mechanisms.</p><p>The risk of coexistence is <strong>operational complexity</strong> — you end up managing two deployment models simultaneously.</p><p>Alerts, monitoring, and scheduler triggers behave differently between them, which can cause confusion if your team isn’t aligned on which runtime each app lives on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OdHZZRRmr3-ZYxBnkvLryw.png" /></figure><h3><strong>The Top 5 Things to Get Right</strong></h3><h4><strong>1. Scheduler Concurrent Execution</strong></h4><p>CH 2.0 runs <strong>multiple replicas by default</strong>, and schedulers fire on <strong>all of them concurrently</strong>. In CH1, a single worker ran one scheduler instance.</p><p>In CH2, if you have 2 replicas and don’t protect against this, your batch job runs twice — reading, writing, and sometimes corrupting the same data.</p><h4><strong>2. `initialState=”stopped”` — The Silent Killer</strong></h4><p>In CH1, stopping a flow at startup was a common ops pattern: deploy stopped, start manually when ready.</p><blockquote>In CH2, <strong>stopped flows cannot be triggered by “Run Now”</strong> — the button silently does nothing. No error, no log, nothing.</blockquote><p>So, remove `initialState=”stopped”` from any flow that needs to run on CH2. If you need controlled startup, manage it via Anypoint Platform’s Flows tab after deployment.</p><h4><strong>3. CloudHub Notifications DO NOT Exist in CH2</strong></h4><p>`cloudhub:create-notification` is a CH1-only feature tied to the CloudHub 1.0 notifications API.</p><p>In CH2, calling it <strong>throws an error at runtime</strong>, which — if inside an error handler — masks the original exception and swallows the real error message.</p><p>To fix this problem just wrap every `cloudhub:create-notification` in a `&lt;try&gt;` scope with a silent `on-error-continue`.</p><h4><strong>4. Runtime and Artifact Configuration</strong></h4><p>Update both `pom.xml` and `mule-artifact.json` consistently before deploying to CH2.</p><p>Missing `javaSpecificationVersions` causes the runtime to default to Java 8 compatibility checks, which can produce unexpected warnings or failures on Java 17 runtimes.</p><h4><strong>5. JAR Naming for Manual Deploys</strong></h4><p>CH2 deployments via Runtime Manager require uploading a JAR. If your pipeline uses dynamic names (commit hash + date), replicate that manually.</p><blockquote>CH2 is stricter, multi-replica aware, and drops CH1-specific APIs.</blockquote><p><strong>Audit every scheduler, every stopped flow, and every CloudHub notification node before you redeploy — then test with “Run Now” and confirm you see logs within seconds.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16ae35acd3fa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/another-integration-blog/deploying-batch-apis-to-cloudhub-2-0-16ae35acd3fa">Deploying Batch APIs to CloudHub 2.0</a> was originally published in <a href="https://medium.com/another-integration-blog">Another Integration Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Last Mile Security in MuleSoft]]></title>
            <link>https://medium.com/another-integration-blog/last-mile-security-in-mulesoft-3a1a5a77daf0?source=rss-5a200f51912e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a1a5a77daf0</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[mulesoft]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[data-security]]></category>
            <dc:creator><![CDATA[Martina Huzanic]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 10:56:01 GMT</pubDate>
            <atom:updated>2026-11-12T00:51:23.777Z</atom:updated>
            <content:encoded><![CDATA[<h4>What it is, when to use it, and what changes on CloudHub 2</h4><h4>What Is Last Mile Security?</h4><p>When you deploy a Mule application behind an API gateway (Anypoint API Manager + a policy layer), inbound traffic flows like this:</p><p><strong><em>Client → [API Gateway / Flex Gateway] → [Mule App HTTP Listener]</em></strong></p><p>The gateway terminates TLS, enforces policies (client ID enforcement, OAuth, rate limiting), and then forwards the request to your Mule app.</p><p>By the time the request reaches your HTTP Listener, it has already been authenticated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OdHZZRRmr3-ZYxBnkvLryw.png" /></figure><p><strong>Last Mile Security</strong> is the mechanism that secures the “final hop*”— from the gateway to the Mule application itself. Without it, anything that can reach your app’s internal port can bypass the gateway entirely and call your API unauthenticated.</p><p>In MuleSoft, this is primarily implemented via the ‘mule-apigateway’ client ID enforcement on the internal listener, or more commonly, by mutual TLS (mTLS) between the gateway and the Mule app.</p><h4>Why It Matters — The Threat It Solves</h4><p>Consider a CloudHub 1 deployment. Your app listens on port 8081. The gateway proxies to it. But port 8081 is also exposed on a shared load balancer or accessible within the VPC.</p><blockquote>Any internal service or an attacker who has reached the internal network can call `http://your-app:8081/api/orders` directly, skipping the gateway, skipping all your policies.</blockquote><p><strong>Last Mile Security closes this gap.</strong></p><p>Without it, your security posture is only as strong as your network perimeter. With it, the Mule app explicitly validates that the caller is the legitimate gateway, not an impersonator.</p><h3>The Three Implementation Approaches</h3><h4>Client ID + Secret Header (simplest, most common).</h4><p>The API gateway injects a `client_id` / `client_secret` header (or a gateway-specific token) when forwarding. The Mule app validates it.</p><p>In Anypoint API Manager, this is the ”Mule OAuth 2.0 Access Token Enforcement” or ”Client ID Enforcement” policy configured with the pointcut targeting the implementation, not the proxy.</p><blockquote>Limitation:The secret travels as a header — if TLS is not enforced on the internal hop, it can be intercepted.</blockquote><h4>Mutual TLS (mTLS) — recommended.</h4><p>The Mule app’s HTTP Listener is configured with a TLS context that requires a client certificate. The gateway presents a certificate signed by a trusted CA. The app only accepts connections from a gateway presenting a valid cert.</p><pre>```xml<br>&lt;http:listener-config name=&quot;httpsListenerConfig&quot;&gt;<br> &lt;http:listener-connection host=&quot;0.0.0.0&quot; port=&quot;8082&quot;<br> tlsContext-ref=&quot;tlsContext&quot; /&gt;<br>&lt;/http:listener-config&gt;<br>&lt;tls:context name=&quot;tlsContext&quot;&gt;<br> &lt;tls:trust-store path=&quot;gateway-truststore.jks&quot;<br> password=&quot;${secure::truststore.password}&quot;<br> insecure=&quot;false&quot; /&gt;<br> &lt;tls:key-store path=&quot;app-keystore.jks&quot;<br> keyPassword=&quot;${secure::keystore.key.password}&quot;<br> password=&quot;${secure::keystore.password}&quot; /&gt;<br>&lt;/tls:context&gt;<br>```</pre><p>The gateway is configured with its own client certificate to present on the outbound connection.</p><h4>IP Allowlisting (network-level, not application-level).</h4><p>Restrict the app’s listener to only accept connections from the gateway’s known IP range. Simpler but brittle — IPs change, especially in cloud environments.</p><h4>When Should You Use Last Mile Security?</h4><p>| Scenario | Use Last Mile Security? |<br>| App exposed directly to internet (no gateway) | N/A — you ARE the perimeter |<br>| App behind API gateway, internet-facing API | Yes — mandatory |<br>| App behind gateway, internal/private network only | Yes — strongly recommended |<br>| App callable only from other internal Mule apps (no gateway) | Situational — use mTLS between apps |<br>| Batch/scheduler-only app, no HTTP listener | No — not applicable |<br>| App in isolated VPC with no external ingress | Minimum — IP allowlist acceptable |</p><p>Rule of thumb: If the Mule app has an HTTP Listener and sits behind a gateway that enforces security policies, assume someone can bypass the gateway unless you implement last mile security.</p><h3>CloudHub 1 vs CloudHub 2 — What Changes?</h3><p>This is where migration gets interesting. The deployment architecture changes significantly between CH1 and CH2, and last mile security must be re-evaluated.</p><h4>CloudHub 1</h4><p>- Apps listen on a **shared load balancer** or **Dedicated Load Balancer (DLB)**<br>- The DLB can be configured to perform mTLS termination and pass a client certificate header to the app<br>- Network isolation between apps is limited — apps in the same VPC could technically reach each other’s ports<br>- The internal port (8081) is often partially exposed; last mile security is recommended but sometimes skipped due to complexity</p><blockquote>Common CH1 pattern: DLB handles TLS, injects `X-Forwarded-Client-Cert` header, app validates the header value matches an expected gateway fingerprint. Not true mTLS at the application layer — it’s header-based trust.</blockquote><h4>CloudHub 2</h4><p>CH2 changes the architecture in ways that directly affect last mile security:</p><p><strong>1. Flex Gateway is the default API gateway</strong><br>CH2 is designed to work with Flex Gateway (running as a sidecar or as a separate service in the same namespace). Flex Gateway supports full mTLS to the upstream Mule app natively. This makes true application-layer mTLS much easier to configure than in CH1.</p><p><strong>2. Private Space networking</strong><br>In CH2 with Private Space, your app runs in a dedicated Kubernetes namespace with an internal network. Apps are not reachable from outside the namespace without explicit ingress configuration.</p><p>This reduces (but does not eliminate) the need for last mile security — a misconfigured ingress or compromised pod in the namespace could still reach your app directly.</p><p><strong>3. Port exposure model is different</strong><br>In CH1, you configured the app port and the DLB mapped it. In CH2, a Kubernetes `Service` and optional `Ingress` expose the app.</p><p>The gateway-to-app hop is internal to the cluster. This is a smaller attack surface than CH1, but “smaller” is not “zero.”</p><p><strong>4. Certificate management</strong><br>CH2 supports secretGroup-based certificate management via Anypoint Security. <strong>Instead of bundling keystores in the app JAR (a CH1 anti-pattern), certificates can be injected at runtime through the CH2 secrets manager.</strong> Migrate your keystores to secretGroups during the CH1→CH2 move.</p><blockquote><strong>Last Mile Security is not a feature — it’s a trust boundary.</strong></blockquote><p><strong>The API gateway is your security enforcement point; last mile security ensures the Mule application only trusts traffic that came through that enforcement point.</strong></p><p>On CH 1, it was often skipped or implemented loosely via header injection. CH 2 with Flex Gateway and Private Space networking makes mTLS-based last mile security significantly easier to implement correctly, and certificate management is cleaner with secretGroups.</p><h4>Migration is the right moment to close any gaps that were accepted as technical debt in CH1.</h4><p>If there’s one change worth making during CH1→CH2 migration beyond the runtime upgrade, it’s upgrading your last mile security from “header trust” to proper mTLS.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a1a5a77daf0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/another-integration-blog/last-mile-security-in-mulesoft-3a1a5a77daf0">Last Mile Security in MuleSoft</a> was originally published in <a href="https://medium.com/another-integration-blog">Another Integration Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ObjectStore on CloudHub 1 vs CloudHub 2]]></title>
            <link>https://medium.com/another-integration-blog/objectstore-on-cloudhub-1-vs-cloudhub-2-f00cfcef77ae?source=rss-5a200f51912e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f00cfcef77ae</guid>
            <category><![CDATA[mulesoft-esb]]></category>
            <category><![CDATA[cloud-migration]]></category>
            <category><![CDATA[mulesoft]]></category>
            <category><![CDATA[anypoint-platform]]></category>
            <dc:creator><![CDATA[Martina Huzanic]]></dc:creator>
            <pubDate>Mon, 02 Nov 2026 09:23:59 GMT</pubDate>
            <atom:updated>2026-11-12T00:51:09.315Z</atom:updated>
            <content:encoded><![CDATA[<h3>What You Need to Know Before Migrating</h3><p>`persistent=”false”` looks the same in both platforms? <strong>It isn’t.</strong></p><p>Neither does `persistent=”true”` behave identically.</p><p><strong>When migrating from CH1 to CH2, ObjectStore is one of the subtlest breaking points </strong>— because the code compiles and deploys fine, and the bug only shows up at runtime under load.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OdHZZRRmr3-ZYxBnkvLryw.png" /></figure><h3>How ObjectStore Works on Each Platform</h3><p><strong>CloudHub 1</strong></p><p>CH1 runs on dedicated (or shared) VMs with Mule workers as JVM processes:</p><p>- `persistent=false` → pure JVM heap. Fast. Isolated per worker. Wiped on restart.<br>- `persistent=true` → CloudHub ObjectStore v1 service (external HTTP-backed). Survives restarts. But still per-worker partitioned unless you explicitly use the `defaultPersistentObjectStore` with the CloudHub connector. Multiple workers each maintain their own partition.</p><p><strong>CloudHub 2</strong><br>CH2 is Kubernetes-based and ships with ObjectStore v2 (OSv2) as the default backing service for all persistent stores. OSv2 is always a remote, managed service:</p><p>- `persistent=false` → in-memory (heap), same as CH1, isolated per replica. No change here.<br>- `persistent=true` → OSv2, which is distributed and shared across all replicas of the same app. This is fundamentally different from CH1.</p><h4>Key Differences</h4><blockquote>| Concern | CloudHub 1 | CloudHub 2 |<br><br>| Default OS service | OSv1 (per worker) | OSv2 (distributed) |<br>| `persistent=true` scope | Per-worker partition | Shared across all replicas |<br>| `persistent=false` | JVM heap | JVM heap (unchanged) |<br>| OS read/write latency | In-process (for in-memory) | External HTTP call (for OSv2) |<br>| Rate limits | Generous / per-worker | OSv2 has TPS limits (300 TPS default) |<br>| Data migration on cutover | Not automatic | Manual export/import required |<br>| TTL eviction reliability | Eventual (CH1) | More predictable (OSv2) |</blockquote><h4>What to Watch Out For When Migrating</h4><h4>1. `persistent=true` is now shared — by design, but check your logic!</h4><p>In CH1 with 4 workers, each worker cached its own copy of an OAuth token. In CH2 with 4 replicas, all replicas hit the same OSv2 store.</p><p>This is usually better (fewer re-auths, consistent state), but it can cause race conditions if multiple replicas simultaneously detect a missing/expired token and all try to refresh and write it at the same time.</p><blockquote>Fix: Wrap the retrieve → check → refresh → store pattern with an `os:store` using `failIfPresent=”true”` to implement optimistic locking, or accept the occasional duplicate write (usually safe for token caching).</blockquote><p>In project I worked on, the `retrieve-token` / `refresh-auth-token` pattern was safe in practice because tokens are idempotent, but verify this assumption for your specific backend.</p><h4>2. Latency increase for `persistent=true`</h4><p>OSv2 is an external HTTP service. Every `os:retrieve` and `os:store` is a network call. In CH1, even the persistent OS had lower latency because it ran within the CloudHub infrastructure close to the worker. In CH2, add 5–30 ms per operation to your latency budget.</p><p>Impact: If you’re calling `os:retrieve` on every API request (e.g., for token caching), this is fine — it’s the exact use case OSv2 is optimised for. If you’re calling it in a tight `&lt;foreach&gt;` loop processing thousands of records, consider batching or caching the value in a Mule variable for the duration of the flow.</p><h4>3. OSv2 rate limits</h4><p>OSv2 has a default limit of 300 TPS per app. High-throughput batch processing that stores intermediate state in the OS per record can hit this. In CH1, in-memory OS had no such limit.</p><blockquote>Fix: For batch jobs, prefer using Mule variables or a DB for intermediate state. Reserve OSv2 for low-frequency, cross-request state (tokens, idempotency keys, watermarks).</blockquote><h4>4. Existing data does NOT migrate automatically</h4><p>On cutover day, your CH1 ObjectStore data (persistent) does not transfer to CH2’s OSv2.</p><p>For most use cases (cached tokens, short-lived state) this is acceptable — the app just re-warms the cache on first use. For use cases where OS state is genuinely durable business data (watermarks for incremental batch jobs, idempotency keys), you need a manual migration plan.</p><p>Export data from CH1 OS via the Anypoint Platform ObjectStore v1 API before decommissioning. Import into OSv2 via the ObjectStore v2 REST API. Or, better, redesign those watermarks to live in a database so they aren’t tied to the runtime.</p><h4>5. `entryTtl` and `expirationInterval` — same config, more reliable behaviour</h4><p>The XML attributes are unchanged. In CH1, TTL eviction was best-effort and could be delayed. OSv2 enforces TTLs more reliably. This is generally a good thing, but verify that your TTL values are intentional — values that were accidentally too short but “worked” in CH1 due to lazy eviction may cause more frequent cache misses in CH2.</p><p>For example,`entryTtl=1680s` (28 min) was deliberately set below the token expiry. That will work correctly — and more predictably — in CH2.</p><h4>Quick Migration Checklist</h4><p>- Audit every `&lt;os:object-store&gt;` — identify whether `persistent=true` state is load-bearing business data or just a runtime cache<br>- Review any “retrieve → check → refresh → store” token patterns for race conditions with multiple replicas<br>- Check for `os:retrieve` / `os:store` calls inside `&lt;foreach&gt;` loops — measure OSv2 latency impact<br>- Verify OSv2 rate limits won’t be hit by your peak throughput<br>- Plan data migration for any persistent OS entries that must survive the CH1→CH2 cutover<br>- Confirm TTL values are intentional — OSv2 will enforce them strictly</p><h4>Bottom Line</h4><p>For the majority of API projects using ObjectStore purely for token caching with short TTLs (`persistent=false` or `persistent=true` with a few entries), CloudHub 2 is a transparent upgrade.</p><p>The projects that need careful attention are those that:</p><p>1. Use `persistent=true` with significant stored state that must survive migration day<br>2. Run high-replica deployments where shared OSv2 state changes the application’s concurrency behaviour<br>3. Call the ObjectStore at high frequency inside batch processing loops</p><h4>For everything else, the XML config doesn’t change, and the app will behave correctly on CH2 out of the box.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f00cfcef77ae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/another-integration-blog/objectstore-on-cloudhub-1-vs-cloudhub-2-f00cfcef77ae">ObjectStore on CloudHub 1 vs CloudHub 2</a> was originally published in <a href="https://medium.com/another-integration-blog">Another Integration Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create a Production-Safe Postman Collection from a Mule Project]]></title>
            <link>https://medium.com/@martinahuzanic/how-to-create-a-production-safe-postman-collection-from-a-mule-project-cb59a7a1e8d3?source=rss-5a200f51912e------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb59a7a1e8d3</guid>
            <dc:creator><![CDATA[Martina Huzanic]]></dc:creator>
            <pubDate>Tue, 27 Oct 2026 10:14:00 GMT</pubDate>
            <atom:updated>2026-11-02T09:27:36.432Z</atom:updated>
            <content:encoded><![CDATA[<h4>The guide throught <strong>production-safe Postman collection creation</strong></h4><p>Testing against a production API is risky by default. A single misfire — an accidental DELETE, a newsletter subscription, a loyalty points deduction — can cause real business impact that’s hard or impossible to reverse. Yet production is often the only environment where you can verify real connectivity, real data flows, and real credentials.</p><blockquote>The goal of a <strong>production-safe Postman collection</strong> is to give you confidence in production without the risk.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OdHZZRRmr3-ZYxBnkvLryw.png" /></figure><p>This guide walks through exactly what to look for in a Mule project before you write a single request.</p><h4><strong>Step 1: Map the Entry Points</strong></h4><p>Open the <strong>main router flow. </strong>This is the APIkit flow that routes all incoming requests. Every `&lt;flow name=”…”&gt;` entry after it represents one API endpoint.</p><p><strong>What to capture:</strong></p><ul><li>HTTP method (GET, POST, PUT, DELETE, PATCH)</li><li>URI template (including path parameters like `{CustomerID}`)</li><li>The `flow-ref` name — this tells you which business logic file handles it</li></ul><pre>```xml<br>&lt;! - Example: this is SAFE - it&#39;s a GET →<br>&lt;flow name=&quot;get:\customer\(CustomerID):api-config&quot;&gt;<br>&lt;flow-ref name=&quot;get-customer-by-id&quot; /&gt;<br>&lt;/flow&gt;<br>&lt;! - Example: this is UNSAFE - it&#39;s a DELETE →<br>&lt;flow name=&quot;delete:\customer\(CustomerID):application\json:api-config&quot;&gt;<br>&lt;flow-ref name=&quot;delete-customer&quot; /&gt;<br>&lt;/flow&gt;</pre><blockquote><strong>Quick rule:</strong></blockquote><blockquote>`GET` = safe.</blockquote><blockquote>`DELETE` = always block.</blockquote><blockquote>`PUT`/`POST`/`PATCH` = read the flow to decide.</blockquote><h4><strong>Step 2: Classify Every Endpoint</strong></h4><p>Build a simple table:</p><p>| Method | Path | Safe? | Reason |</p><p>| GET | /customer/{id} | Y | Read-only |</p><p>| PUT | /newsletter/subscribe | N | Creates real subscription |</p><p>| DELETE | /customer/{id} | N | Irreversible |</p><p>| POST | /rechargePoints/{id}/{sub} | N | Modifies loyalty balance |</p><p>| POST | /newsletter/checkCustomer | Y | Check only, no write |</p><h4><strong>Gray area rules:</strong></h4><p>- `POST /auth/*/login` → usually safe (just gets a token)</p><p>- `POST /*/check*` or `POST /*/validate*` → usually safe (read-like)</p><p>- `POST /*/fire` or `POST /*/send` → always block (triggers external action)</p><p>- `PUT` that writes to external systems (ERP, FTP, email) → always block</p><h4><strong>Step 3: Trace the Authentication Chain</strong></h4><p>Open `global.xml` and the `utils/` folder. Mule apps typically have layered auth:</p><p><strong>Layer 1 — Anypoint API Manager policy</strong> (checked by the platform before Mule even sees the request). This means the API has a Client ID Enforcement policy. Every request needs `client_id` header AND `client_secret` header</p><p><strong>Layer 2 — Backend credentials</strong> (how Mule authenticates to the downstream system). Look in utils/token.xml for: retrieve-token, refresh-auth-token sub-flows. Also, look in global.xml for: HTTP request configs (host, basepath, auth type)</p><h4><strong>What to document per collection:</strong></h4><p>1. Which headers the caller must send</p><p>2. Which headers Mule manages internally</p><p>3. Which credentials are encrypted (Blowfish/AES in secure properties)</p><h4><strong>Step 4: Read the Config Properties</strong></h4><p>Open `src/main/resources/prod/prod-config.properties` for the production backend host.</p><p><strong>Key things to extract:</strong></p><pre>```properties<br>api.host=example.com ← backend hostname<br>api.port=443<br>api.basepath=/<br>papi.env=www ← environment prefix<br>papi.host=xyl.rest.marketingcloud.com<br>```<br>Also check `prod-sec-config.properties` for encrypted values:<br>```properties<br>api.password=![EncryptedValue] ← needs decryption<br>```</pre><p>Note which credentials are encrypted. You cannot use them directly in Postman without decrypting first. Document the encryption algorithm and key location so the team knows what they need.</p><p>Also check `global.xml` for the `autodiscovery.id` — this confirms which API instance is registered in API Manager for prod.</p><h4><strong>Step 5: Identify the Real Base URL</strong></h4><p>For CloudHub 2.0 (CH2) apps, the base URL is <strong>not</strong> in the config files — it’s assigned by the Anypoint Runtime Manager at deployment time.</p><p>Use a `{{base_url}}` variable in Postman so the collection isn’t hardcoded.</p><h4><strong>Step 6: Build the Collection Structure</strong></h4><p>Use a consistent folder structure across all your API collections:</p><p>Collection: {app-name} System API — PROD [SAFE TESTING ONLY]</p><p>├── 0 — Connectivity Tests ← always first, no business data</p><p>├── 1 — {Domain} Read [SAFE] ← GET endpoints grouped by domain</p><p>├── 2 — {Domain} Read [SAFE]</p><p>├── …</p><p>└── N — UNSAFE — BLOCKED ← always last, all write operations</p><h4><strong>Step 7: Write the Connectivity Tests</strong></h4><p>These go in folder 0 and require no real business data. They confirm the app is alive and the security policy is active.</p><p><strong>Test 1 — Wrong credentials (401):</strong></p><pre>```http<br>GET {{base_url}}/api/{any-valid-path}<br>Headers:<br>client_id: WRONG_CLIENT_ID_TEST<br>client_secret: WRONG_SECRET_TEST<br>```</pre><p>Expected: `401 Unauthorized` from the API Manager policy.</p><p><strong>Test 2 — Invalid path (404):</strong></p><pre>```http<br>GET {{base_url}}/api/no-such-endpoint-connectivity-check<br>Headers:<br>client_id: {{client_id}}<br>client_secret: {{client_secret}}<br>```</pre><p>Expected: `404 Not Found` from the APIkit router.</p><p>Add Postman test scripts to assert the expected status codes:</p><pre>```javascript<br>pm.test(&#39;Policy is active (401)&#39;, function () {<br>pm.expect(pm.response.code).to.equal(401);<br>});<br>```</pre><h4><strong>Step 8: Block Unsafe Endpoints with Pre-Request Scripts</strong></h4><p>For every endpoint in the UNSAFE folder, add a <strong>pre-request script</strong> that throws before the request fires:</p><pre>```javascript<br>throw new Error(<br>&#39;UNSAFE: PUT /api/customer WRITES customer data in PRODUCTION. &#39; +<br>&#39;Remove this script only if you intend to mutate production data.&#39;<br>);<br>```</pre><p><strong>This is more reliable than just “not sending”</strong> — it makes the block explicit, visible, and hard to accidentally remove.</p><h4><strong>Step 9: Set Collection Variables</strong></h4><p>Define all variables at the <strong>collection level </strong>(not environment level) so the collection is self-contained:</p><p>| Variable | Value | Notes |</p><p>| `base_url` | (fill in from Runtime Manager) | CH2 app URL |</p><p>| `client_id` | `5dxvy…` | From API Manager |</p><p>| `client_secret` | `9Eyvy…` | From API Manager |</p><p>| `country` | CRO` | Routing header |</p><p>| `customer_id` | (fill in from search result) | Real prod ID |</p><blockquote><strong>Never hardcode IDs from a specific customer</strong> in the default values — use realistic placeholder descriptions so the tester knows what to fill in.</blockquote><h4><strong>Step 10: Validate the JSON</strong></h4><p>Before committing, always validate your collection file:</p><pre>```bash<br>python3 -m json.tool your-collection.postman_collection.json &gt; /dev/null &amp;&amp; echo &quot;VALID&quot;<br># or<br>node -e &quot;JSON.parse(require(&#39;fs&#39;).readFileSync(&#39;your-collection.postman_collection.json&#39;,&#39;utf8&#39;)); console.log(&#39;VALID&#39;)&quot;</pre><p>A malformed JSON collection will silently fail to import in Postman with no useful error message.</p><p><strong>Key Insight: Trust the HTTP Method, Then Verify the Flow</strong></p><p>The HTTP method is your first signal but not the final answer.</p><p>A `POST /*/check*` endpoint might be perfectly safe.</p><p>A `PUT /customer/{id}/fidelitySubscriptions` modifies loyalty data with financial impact. Always open the actual Mule flow XML and trace what it does to the backend before deciding.</p><p>When in doubt, <strong>block it</strong>. It takes 10 seconds to remove a pre-request block script. It takes a support ticket and a database fix to undo an accidental production write.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb59a7a1e8d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Elementary Steps for CloudHub 1.0 → CloudHub 2.0 Migration]]></title>
            <link>https://medium.com/@martinahuzanic/elementary-steps-for-cloudhub-1-0-cloudhub-2-0-migration-e5b1cdca509e?source=rss-5a200f51912e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5b1cdca509e</guid>
            <category><![CDATA[cloudhub]]></category>
            <category><![CDATA[hands-on-tutorials]]></category>
            <category><![CDATA[mulesoft]]></category>
            <category><![CDATA[cloudhub-2]]></category>
            <category><![CDATA[migration]]></category>
            <dc:creator><![CDATA[Martina Huzanic]]></dc:creator>
            <pubDate>Thu, 22 Oct 2026 11:00:59 GMT</pubDate>
            <atom:updated>2026-11-02T09:29:04.422Z</atom:updated>
            <content:encoded><![CDATA[<h4>Based on real-world MuleSoft migration experience here is what you need to consider</h4><h4>Overview</h4><p>CloudHub 2.0 (CH2.0) is a container-based runtime deployed on Private Spaces (Kubernetes). It replaces the legacy worker-based CloudHub 1.0 model with replicas, making migration a mix of code changes, config adjustments, and platform onboarding steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OdHZZRRmr3-ZYxBnkvLryw.png" /></figure><h4>Step 1 — Pre-Migration Analysis</h4><p>Before touching any code, gather the following data for each application:</p><blockquote><strong>CH1.0 app name </strong>Runtime Manager → CloudHub</blockquote><blockquote><strong>CH2.0 app name &gt; </strong>Target name</blockquote><blockquote>A<strong>PI ID CH / CH2.0 </strong>API Manager → autodiscovery IDs per env</blockquote><blockquote><strong>CH Workers/Size</strong>Runtime Manager current CH1.0 worker count + size</blockquote><blockquote><strong>CH2.0 Replica/Size</strong>Target mule.nano / mule.small / mule.micro</blockquote><blockquote><strong>Static IP </strong>Check staticIPEnabled — critical for external whitelist</blockquote><blockquote><strong>Upper dependencies — </strong>Who calls this API (consumers)</blockquote><blockquote><strong>Lower dependencies — </strong>What this API calls (downstream)</blockquote><blockquote><strong>ObjectStore usage — </strong>Token cache? Key definitions?</blockquote><blockquote><strong>Schedulers</strong>Any scheduler flows?</blockquote><blockquote><strong>CloudHub notifications</strong>cloudhub:create-notification in error handlers?</blockquote><h4>Step 2 — `pom.xml` Updates</h4><pre>```xml<br>&lt;! - Runtime →<br>  &lt;app.runtime&gt;4.9.0&lt;/app.runtime&gt;<br>&lt;! - Java version →<br>&lt;java.version&gt;17&lt;/java.version&gt;<br>  &lt;! - Mule Maven Plugin →<br>&lt;mule.maven.plugin.version&gt;4.3.0&lt;/mule.maven.plugin.version&gt;<br>&lt;! - Version convention →<br>  &lt;version&gt;1.0.1-SNAPSHOT&lt;/version&gt; &lt;! - Sandbox/Test →<br>  &lt;version&gt;1.0.1&lt;/version&gt; &lt;! - Production (no SNAPSHOT) →<br>&lt;! - Add classifier for CH2.0 deployment →<br>&lt;configuration&gt;<br> &lt;classifier&gt;mule-application&lt;/classifier&gt;<br>&lt;/configuration&gt;<br><br>```</pre><h4>Step 3 — `mule-artifact.json` Updates</h4><p>{<br> “minMuleVersion”: “4.9.0”,<br> “javaSpecificationVersions”: [“17”],<br> “secureProperties”: [ … ]<br>}</p><blockquote>Do not set `minMuleVersion` higher than the lowest runtime version across all your environments. Plan a coordinated runtime upgrade or accept the constraint.</blockquote><h4>Step 4 — Fix File Path Separators in `global.xml`</h4><p>CH2.0 runs on Linux containers. Windows-style backslashes in config file paths will silently fail at startup.</p><pre>```xml<br>&lt;! - BEFORE (Windows backslash) →<br>&lt;configuration-properties file=&quot;${env}\\${env}-config.properties&quot; /&gt;<br>&lt;secure-properties:config file=&quot;${env}\\${env}-sec-config.properties&quot; … /&gt;<br>&lt;! - AFTER (Linux forward slash) →<br>&lt;configuration-properties file=&quot;${env}/${env}-config.properties&quot; /&gt;<br>&lt;secure-properties:config file=&quot;${env}/${env}-sec-config.properties&quot; … /&gt;<br>```</pre><h4><strong>Step 5 — Wrap `cloudhub:create-notification` in Try Scope or Remove them.</strong></h4><p>`cloudhub:create-notification` is not supported in CH2.0. If a notification fails, without a Try scope it will swallow the original error and ropagate a misleading error instead.</p><blockquote>This change is backwards-compatible — it does not affect CH1.0 behavior.</blockquote><h4>Step 6 — Scheduler: Prevent Concurrent Execution</h4><p>In CH2.0, schedulers run concurrently by default across replicas. A 24-hour refresh scheduler with 3 replicas will fire 3 simultaneous executions.</p><blockquote>`primaryNodeOnly` is not a valid attribute on `&lt;scheduler&gt;` in Mule 4 XSD. To restrict a scheduler to run only on one replica, implement a distributed lock pattern via ObjectStore or handle it at the application level.</blockquote><h4><strong>Step 7 — ObjectStore V2 (OS V2)</strong></h4><p>In CH2.0, the Mule ObjectStore connector automatically connects to Anypoint ObjectStore V2 — a cloud-managed, distributed store shared across all replicas.</p><p>Make the ObjectStore persistent if needed. Also, add TTL for token/credential caches. If the ObjectStore holds OAuth access tokens or auth credentials set TTL ≤ token expiry to prevent stale token reuse across replicas.</p><blockquote>If a scheduler refreshes the OS cache (e.g., key definitions from DB), ensure only one replica runs it. Use `disallowConcurrentExecution=”true”` to prevent overlap within a replica, and consider implementing a distributed lock to prevent cross-replica execution.</blockquote><p>Enable OS V2 in Runtime Manager</p><p>In CH1.0 with multiple workers, each worker had an isolated ObjectStore partition.<strong> In CH2.0 with OS V2, all replicas share the same store.</strong> Review any logic that assumed per-worker isolation.</p><h4>Step 8 — Autodiscovery ID Update</h4><p>CH2.0 requires a new API Manager instance. Update the `app.autodiscovery.id` in your environment-specific config properties</p><p>Verify the same policies are applied to the new CH2.0 API instance as the old CH1.0 instance (client enforcement, SLA tiers, rate limiting). For this you can use script from my last article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5b1cdca509e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Dive: Automating Anypoint API Manager Instance Cloning with Bash]]></title>
            <link>https://medium.com/another-integration-blog/deep-dive-automating-anypoint-api-manager-instance-cloning-with-bash-637a1b6725d1?source=rss-5a200f51912e------2</link>
            <guid isPermaLink="false">https://medium.com/p/637a1b6725d1</guid>
            <category><![CDATA[mulesoft]]></category>
            <category><![CDATA[anypoint-platform]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Martina Huzanic]]></dc:creator>
            <pubDate>Wed, 05 Aug 2026 20:51:00 GMT</pubDate>
            <atom:updated>2026-11-02T09:33:16.262Z</atom:updated>
            <content:encoded><![CDATA[<h4>Production-grade Bash automation that solves the problem</h4><h4><strong>Overview</strong></h4><p>Managing multiple environments — dev, staging, production, regional deployments — is one of the most operationally demanding aspects of running a serious MuleSoft integration platform.</p><p>When a new API deployment target must mirror an existing API Manager instance with all its policies and consumer contracts intact, doing this manually through the Anypoint Platform UI is both time-consuming and error-prone.</p><p>`api_cloning_script.sh` is a production-grade Bash automation that solves this problem end-to-end: given a source API instance ID and a target Exchange asset, it recreates the full API Manager configuration — endpoint settings, every attached policy (including pointcut conditions), and all approved client application contracts — in a single automated run.</p><p>This article examines the script’s design, its architectural decisions, the API platform quirks it works around, and the places where it could be hardened further.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OdHZZRRmr3-ZYxBnkvLryw.png" /></figure><h4><strong>What the Script Does: The 5-Step Pipeline</strong></h4><p>The script is structured around a clearly labelled five-step workflow printed to stdout as it runs. This makes log output readable whether the script runs interactively or inside a CI/CD pipeline.</p><p>[0/5] Authentication</p><p>[1/5] Environment confirmation</p><p>[2/5] Source API fetch + new instance creation</p><p>[3/5] Policy retrieval via CLI</p><p>[4/5] Policy application (POST + PATCH)</p><p>[5/5] Contract cloning</p><pre>#!/usr/bin/env bash<br>set -eo pipefail<br><br># --- ENVIRONMENT CONFIGURATION ---<br># These must be exported in your shell session before running this script:<br>#   export ANYPOINT_CONNECTED_APP_ID=&quot;&lt;connected-app-client-id&gt;&quot;<br>#   export ANYPOINT_CONNECTED_APP_SECRET=&quot;&lt;connected-app-client-secret&gt;&quot;<br>#   export ANYPOINT_ORG_ID=&quot;&lt;organization-id&gt;&quot;<br>#   export ANYPOINT_ENV_NAME=&quot;&lt;environment-name&gt;&quot;   # e.g. Development<br>#   export ANYPOINT_ENV_ID=&quot;&lt;environment-id&gt;&quot;       # UUID of the environment above<br>#<br># POLICY READING  : anypoint-cli-v4 stored user session (reads ALL policy types)<br># POLICY APPLYING : Connected App REST API (POST + PATCH for pointcutData)<br># INSTANCE / CONTRACTS: Connected App REST API<br>#<br># Prerequisite: anypoint-cli-v4 must be logged in:<br>#   npx anypoint-cli-v4 conf --username &lt;user&gt; --password &lt;pass&gt;<br><br>ANYPOINT_CLIENT_ID=&quot;${ANYPOINT_CONNECTED_APP_ID}&quot;<br>ANYPOINT_CLIENT_SECRET=&quot;${ANYPOINT_CONNECTED_APP_SECRET}&quot;<br><br># Validate required environment variables<br>MISSING_VARS=()<br>[[ -z &quot;$ANYPOINT_CONNECTED_APP_ID&quot; ]]     &amp;&amp; MISSING_VARS+=(&quot;ANYPOINT_CONNECTED_APP_ID&quot;)<br>[[ -z &quot;$ANYPOINT_CONNECTED_APP_SECRET&quot; ]] &amp;&amp; MISSING_VARS+=(&quot;ANYPOINT_CONNECTED_APP_SECRET&quot;)<br>[[ -z &quot;$ANYPOINT_ORG_ID&quot; ]]              &amp;&amp; MISSING_VARS+=(&quot;ANYPOINT_ORG_ID&quot;)<br>[[ -z &quot;$ANYPOINT_ENV_NAME&quot; ]]            &amp;&amp; MISSING_VARS+=(&quot;ANYPOINT_ENV_NAME&quot;)<br>[[ -z &quot;$ANYPOINT_ENV_ID&quot; ]]             &amp;&amp; MISSING_VARS+=(&quot;ANYPOINT_ENV_ID&quot;)<br><br>if [ ${#MISSING_VARS[@]} -gt 0 ]; then<br>    echo &quot;Error: The following required environment variables are not set:&quot;<br>    for VAR in &quot;${MISSING_VARS[@]}&quot;; do echo &quot;  - $VAR&quot;; done<br>    echo &quot;&quot;<br>    echo &quot;Export them in your shell before running this script:&quot;<br>    echo &quot;  export ANYPOINT_CONNECTED_APP_ID=\&quot;&lt;connected-app-client-id&gt;\&quot;&quot;<br>    echo &quot;  export ANYPOINT_CONNECTED_APP_SECRET=\&quot;&lt;connected-app-client-secret&gt;\&quot;&quot;<br>    echo &quot;  export ANYPOINT_ORG_ID=\&quot;&lt;organization-id&gt;\&quot;&quot;<br>    echo &quot;  export ANYPOINT_ENV_NAME=\&quot;&lt;environment-name&gt;\&quot;&quot;<br>    echo &quot;  export ANYPOINT_ENV_ID=\&quot;&lt;environment-id&gt;\&quot;&quot;<br>    exit 1<br>fi<br><br>if [ &quot;$#&quot; -lt 3 ] || [ &quot;$#&quot; -gt 4 ]; then<br>    echo &quot;Usage: $0 &lt;ORIGINAL_API_ID&gt; &lt;EXCHANGE_ASSET_ID&gt; &lt;EXCHANGE_ASSET_VERSION&gt; [INSTANCE_LABEL]&quot;<br>    echo &quot;Example: $0 21027368 system-api 1.0.3 CH2&quot;<br>    exit 1<br>fi<br><br>ORIGINAL_API_ID=&quot;$1&quot;<br>CH2_ASSET_ID_NAME=&quot;$2&quot;<br>CH2_ASSET_VERSION=&quot;$3&quot;<br>INSTANCE_LABEL=&quot;${4:-CH2}&quot;<br><br>echo &quot;Source API ID        : $ORIGINAL_API_ID&quot;<br>echo &quot;Target Asset ID      : $CH2_ASSET_ID_NAME&quot;<br>echo &quot;Target Asset Version : $CH2_ASSET_VERSION&quot;<br>echo &quot;Instance Label       : $INSTANCE_LABEL&quot;<br>echo &quot;Organization ID      : $ANYPOINT_ORG_ID&quot;<br>echo &quot;Environment Name     : $ANYPOINT_ENV_NAME&quot;<br>echo &quot;==========================================================&quot;<br>echo &quot;DYNAMIC API, POLICY &amp; CONTRACT CLONING&quot;<br>echo &quot;==========================================================&quot;<br><br># ---------------------------------------------------------------------------<br># Helper: apply pointcutData via PATCH if source policy had conditions<br># ---------------------------------------------------------------------------<br>apply_pointcut() {<br>  local instance_id=&quot;$1&quot; policy_id=&quot;$2&quot; pointcut=&quot;$3&quot; token=&quot;$4&quot; asset_id=&quot;$5&quot;<br>  if [ &quot;$pointcut&quot; != &quot;null&quot; ] &amp;&amp; [ -n &quot;$pointcut&quot; ]; then<br>    PC_RESP=$(curl -s --max-time 30 -w &quot;\n%{http_code}&quot; -X PATCH \<br>      &quot;https://anypoint.mulesoft.com/apimanager/api/v1/organizations/${ANYPOINT_ORG_ID}/environments/${ANYPOINT_ENV_ID}/apis/${instance_id}/policies/${policy_id}&quot; \<br>      -H &quot;Authorization: Bearer ${token}&quot; -H &quot;Content-Type: application/json&quot; \<br>      -d &quot;{\&quot;pointcutData\&quot;: ${pointcut}}&quot;)<br>    PC_CODE=$(echo &quot;$PC_RESP&quot; | tail -1)<br>    if [ &quot;$PC_CODE&quot; -eq 200 ]; then<br>      echo &quot;  Pointcut condition applied to &#39;${asset_id}&#39;.&quot;<br>    else<br>      echo &quot;  WARNING: Pointcut PATCH for &#39;${asset_id}&#39; returned HTTP ${PC_CODE}.&quot;<br>    fi<br>  fi<br>}<br><br># ---------------------------------------------------------------------------<br># STEP 0 — Bearer token<br># ---------------------------------------------------------------------------<br>echo &quot;[0/5] Authenticating with Connected App credentials...&quot;<br>ACCESS_TOKEN=$(curl -s -X POST &quot;https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token&quot; \<br>  -H &quot;Content-Type: application/x-www-form-urlencoded&quot; \<br>  -d &quot;client_id=${ANYPOINT_CLIENT_ID}&quot; \<br>  -d &quot;client_secret=${ANYPOINT_CLIENT_SECRET}&quot; \<br>  -d &quot;grant_type=client_credentials&quot; | jq -r &#39;.access_token&#39;)<br><br>if [ -z &quot;$ACCESS_TOKEN&quot; ] || [ &quot;$ACCESS_TOKEN&quot; == &quot;null&quot; ]; then<br>  echo &quot;ERROR: Failed to generate Bearer token.&quot;<br>  exit 1<br>fi<br>echo &quot;Bearer token generated successfully.&quot;<br><br># ---------------------------------------------------------------------------<br># STEP 1 — Confirm environment<br># ---------------------------------------------------------------------------<br>echo &quot;[1/5] Using environment: ${ANYPOINT_ENV_NAME} (${ANYPOINT_ENV_ID})&quot;<br>echo &quot;----------------------------------------------------------&quot;<br><br># ---------------------------------------------------------------------------<br># STEP 2 — Fetch source API config and create new API Manager instance<br># ---------------------------------------------------------------------------<br>echo &quot;[2/5] Fetching source API configuration (${ORIGINAL_API_ID})...&quot;<br><br>SOURCE_API=$(curl -s \<br>  &quot;https://anypoint.mulesoft.com/apimanager/api/v1/organizations/${ANYPOINT_ORG_ID}/environments/${ANYPOINT_ENV_ID}/apis/${ORIGINAL_API_ID}&quot; \<br>  -H &quot;Authorization: Bearer ${ACCESS_TOKEN}&quot;)<br><br>SRC_URI=$(echo &quot;$SOURCE_API&quot;       | jq -r &#39;.endpoint.uri       // &quot;&quot;&#39;)<br>SRC_PROXY_URI=$(echo &quot;$SOURCE_API&quot; | jq -r &#39;.endpoint.proxyUri  // &quot;&quot;&#39;)<br>SRC_IS_CH=$(echo &quot;$SOURCE_API&quot;     | jq -r &#39;.endpoint.isCloudHub // false&#39;)<br>SRC_TYPE=$(echo &quot;$SOURCE_API&quot;      | jq -r &#39;.endpoint.type      // &quot;raml&quot;&#39;)<br>SRC_TECH=$(echo &quot;$SOURCE_API&quot;      | jq -r &#39;.technology         // &quot;mule4&quot;&#39;)<br><br>echo &quot;  Source endpoint uri : $SRC_URI  |  type: $SRC_TYPE  |  isCloudHub: $SRC_IS_CH&quot;<br><br>PROXY_URI=&quot;${SRC_PROXY_URI:-http://0.0.0.0:8081}&quot;<br>[ -z &quot;$PROXY_URI&quot; ] &amp;&amp; PROXY_URI=&quot;http://0.0.0.0:8081&quot;<br><br>echo &quot;Creating new API Manager instance for asset: ${CH2_ASSET_ID_NAME} v${CH2_ASSET_VERSION}...&quot;<br><br>REQUEST_BODY=$(jq -n \<br>  --arg assetId  &quot;${CH2_ASSET_ID_NAME}&quot; --arg version &quot;${CH2_ASSET_VERSION}&quot; \<br>  --arg groupId  &quot;${ANYPOINT_ORG_ID}&quot;   --arg uri     &quot;${SRC_URI}&quot; \<br>  --arg proxyUri &quot;${PROXY_URI}&quot;         --argjson isCH &quot;${SRC_IS_CH}&quot; \<br>  --arg type     &quot;${SRC_TYPE}&quot;          --arg tech    &quot;${SRC_TECH}&quot; \<br>  --arg label    &quot;${INSTANCE_LABEL}&quot; \<br>  &#39;{spec:{assetId:$assetId,version:$version,groupId:$groupId},<br>    endpoint:{uri:$uri,proxyUri:$proxyUri,isCloudHub:$isCH,muleVersion4OrAbove:true,type:$type},<br>    instanceLabel:$label, technology:$tech}&#39;)<br><br>CREATE_RESPONSE=$(curl -s -X POST \<br>  &quot;https://anypoint.mulesoft.com/apimanager/api/v1/organizations/${ANYPOINT_ORG_ID}/environments/${ANYPOINT_ENV_ID}/apis&quot; \<br>  -H &quot;Authorization: Bearer ${ACCESS_TOKEN}&quot; -H &quot;Content-Type: application/json&quot; -d &quot;${REQUEST_BODY}&quot;)<br><br>NEW_INSTANCE_ID=$(echo &quot;$CREATE_RESPONSE&quot; | jq -r &#39;.id&#39;)<br>if [ -z &quot;$NEW_INSTANCE_ID&quot; ] || [ &quot;$NEW_INSTANCE_ID&quot; == &quot;null&quot; ]; then<br>  echo &quot;ERROR: Failed to create API instance. Response: $CREATE_RESPONSE&quot;<br>  exit 1<br>fi<br>echo &quot;API Instance ID: $NEW_INSTANCE_ID&quot;<br>echo &quot;----------------------------------------------------------&quot;<br><br># ---------------------------------------------------------------------------<br># STEP 3 — Read ALL policies via CLI (stored user session reads all types)<br># ---------------------------------------------------------------------------<br>echo &quot;[3/5] Retrieving policies from source API instance (${ORIGINAL_API_ID}) via CLI...&quot;<br><br>POLICIES_JSON=$(npx anypoint-cli-v4 api-mgr:policy:list \<br>  --organization &quot;${ANYPOINT_ORG_ID}&quot; --environment &quot;${ANYPOINT_ENV_NAME}&quot; \<br>  --output json &quot;${ORIGINAL_API_ID}&quot; 2&gt;/dev/null)<br><br>POLICY_COUNT=$(echo &quot;$POLICIES_JSON&quot; | jq &#39;length&#39; 2&gt;/dev/null || echo &quot;0&quot;)<br>echo &quot;Found ${POLICY_COUNT} policies to clone.&quot;<br><br># ---------------------------------------------------------------------------<br># STEP 4 — Apply each policy (POST config + PATCH pointcutData)<br># ---------------------------------------------------------------------------<br>POLICY_GROUP_ID=&quot;68ef9520-24e9-4cf2-b2f5-620025690913&quot;<br><br>if [ &quot;$POLICY_COUNT&quot; -eq 0 ]; then<br>  echo &quot;No policies found. Skipping.&quot;<br>  echo &quot;[4/5] Skipped (no policies).&quot;<br>else<br>  echo &quot;[4/5] Applying policies to new API instance...&quot;<br><br>  for ((i=0; i&lt;POLICY_COUNT; i++)); do<br>    POLICY_ASSET_ID=$(echo &quot;$POLICIES_JSON&quot;  | jq -r &quot;.[$i][\&quot;Asset ID\&quot;]&quot;)<br>    POLICY_ASSET_VER=$(echo &quot;$POLICIES_JSON&quot; | jq -r &quot;.[$i][\&quot;Asset Version\&quot;]&quot;)<br>    YAML_CONFIG=$(echo &quot;$POLICIES_JSON&quot;      | jq -r &quot;.[$i].Configuration // \&quot;\&quot;&quot;)<br>    POLICY_STATUS=$(echo &quot;$POLICIES_JSON&quot;    | jq -r &quot;.[$i].Status // \&quot;Enabled\&quot;&quot;)<br>    SRC_POLICY_ID=$(echo &quot;$POLICIES_JSON&quot;    | jq -r &quot;.[$i].ID&quot;)<br><br>    echo &quot;  Applying: ${POLICY_ASSET_ID} v${POLICY_ASSET_VER} (${POLICY_STATUS})...&quot;<br><br>    # Convert YAML config → JSON<br>    JSON_CONFIG=$(node -e &#39;<br>      const input = require(&quot;fs&quot;).readFileSync(0,&quot;utf-8&quot;).trim();<br>      let currentKey=null; const r={};<br>      input.split(&quot;\n&quot;).forEach(line=&gt;{<br>        const lm=line.match(/^(\s*)- (.+)$/);<br>        const km=line.match(/^([^:\s][^:]*):\s*(.*)$/);<br>        if(km&amp;&amp;!lm){ currentKey=km[1].trim(); const v=km[2].trim(); r[currentKey]=v?v:[]; }<br>        else if(lm&amp;&amp;currentKey){ if(!Array.isArray(r[currentKey]))r[currentKey]=[]; r[currentKey].push(lm[2].trim()); }<br>      });<br>      console.log(JSON.stringify(r));<br>    &#39; &lt;&lt;&lt; &quot;$YAML_CONFIG&quot;)<br><br>    # Fetch pointcutData from source policy individual endpoint<br>    POINTCUT_DATA=$(curl -s --max-time 15 \<br>      &quot;https://anypoint.mulesoft.com/apimanager/api/v1/organizations/${ANYPOINT_ORG_ID}/environments/${ANYPOINT_ENV_ID}/apis/${ORIGINAL_API_ID}/policies/${SRC_POLICY_ID}&quot; \<br>      -H &quot;Authorization: Bearer ${ACCESS_TOKEN}&quot; | jq -c &#39;.pointcutData // null&#39;)<br><br>    # POST policy without pointcutData (POST with pointcutData causes server-side hang)<br>    APPLY_RESP=$(curl -s --max-time 30 -w &quot;\n%{http_code}&quot; -X POST \<br>      &quot;https://anypoint.mulesoft.com/apimanager/api/v1/organizations/${ANYPOINT_ORG_ID}/environments/${ANYPOINT_ENV_ID}/apis/${NEW_INSTANCE_ID}/policies&quot; \<br>      -H &quot;Authorization: Bearer ${ACCESS_TOKEN}&quot; -H &quot;Content-Type: application/json&quot; \<br>      -d &quot;{\&quot;assetId\&quot;:\&quot;${POLICY_ASSET_ID}\&quot;,\&quot;assetVersion\&quot;:\&quot;${POLICY_ASSET_VER}\&quot;,\&quot;groupId\&quot;:\&quot;${POLICY_GROUP_ID}\&quot;,\&quot;configurationData\&quot;:${JSON_CONFIG}}&quot;)<br><br>    HTTP_CODE=$(echo &quot;$APPLY_RESP&quot; | tail -1)<br>    APPLY_BODY=$(echo &quot;$APPLY_RESP&quot; | head -1)<br><br>    if [ &quot;$HTTP_CODE&quot; -eq 201 ] || [ &quot;$HTTP_CODE&quot; -eq 200 ]; then<br>      NEW_POLICY_ID=$(echo &quot;$APPLY_BODY&quot; | jq -r &#39;.id&#39;)<br>      echo &quot;  Policy &#39;${POLICY_ASSET_ID}&#39; applied (ID: ${NEW_POLICY_ID}).&quot;<br>      apply_pointcut &quot;$NEW_INSTANCE_ID&quot; &quot;$NEW_POLICY_ID&quot; &quot;$POINTCUT_DATA&quot; &quot;$ACCESS_TOKEN&quot; &quot;$POLICY_ASSET_ID&quot;<br>      [ &quot;${POLICY_STATUS}&quot; == &quot;Disabled&quot; ] &amp;&amp; echo &quot;  Note: Source was Disabled — toggle manually in API Manager UI if needed.&quot;<br><br>    elif echo &quot;$APPLY_BODY&quot; | grep -q &quot;missingProperty&quot;; then<br>      # Secret field redacted — inject placeholder so policy is still created<br>      MISSING=$(echo &quot;$APPLY_BODY&quot; | jq -r &#39;.errors[0].params.missingProperty // &quot;unknown&quot;&#39; 2&gt;/dev/null)<br>      echo &quot;  Secret field &#39;${MISSING}&#39; is redacted — applying with placeholder &#39;PLACEHOLDER_UPDATE_ME&#39;...&quot;<br>      JSON_PH=$(echo &quot;$JSON_CONFIG&quot; | jq --arg k &quot;$MISSING&quot; --arg v &quot;PLACEHOLDER_UPDATE_ME&quot; &#39;. + {($k):$v}&#39;)<br>      RETRY_RESP=$(curl -s --max-time 30 -w &quot;\n%{http_code}&quot; -X POST \<br>        &quot;https://anypoint.mulesoft.com/apimanager/api/v1/organizations/${ANYPOINT_ORG_ID}/environments/${ANYPOINT_ENV_ID}/apis/${NEW_INSTANCE_ID}/policies&quot; \<br>        -H &quot;Authorization: Bearer ${ACCESS_TOKEN}&quot; -H &quot;Content-Type: application/json&quot; \<br>        -d &quot;{\&quot;assetId\&quot;:\&quot;${POLICY_ASSET_ID}\&quot;,\&quot;assetVersion\&quot;:\&quot;${POLICY_ASSET_VER}\&quot;,\&quot;groupId\&quot;:\&quot;${POLICY_GROUP_ID}\&quot;,\&quot;configurationData\&quot;:${JSON_PH}}&quot;)<br>      RETRY_CODE=$(echo &quot;$RETRY_RESP&quot; | tail -1)<br>      if [ &quot;$RETRY_CODE&quot; -eq 201 ] || [ &quot;$RETRY_CODE&quot; -eq 200 ]; then<br>        NEW_POLICY_ID=$(echo &quot;$RETRY_RESP&quot; | head -1 | jq -r &#39;.id&#39;)<br>        echo &quot;  Policy &#39;${POLICY_ASSET_ID}&#39; applied with placeholder (ID: ${NEW_POLICY_ID}).&quot;<br>        echo &quot;  *** ACTION REQUIRED: Update &#39;${MISSING}&#39; in API Manager UI for policy &#39;${POLICY_ASSET_ID}&#39;. ***&quot;<br>        apply_pointcut &quot;$NEW_INSTANCE_ID&quot; &quot;$NEW_POLICY_ID&quot; &quot;$POINTCUT_DATA&quot; &quot;$ACCESS_TOKEN&quot; &quot;$POLICY_ASSET_ID&quot;<br>      else<br>        echo &quot;  WARNING: Could not apply &#39;${POLICY_ASSET_ID}&#39; even with placeholder (HTTP ${RETRY_CODE}).&quot;<br>        echo &quot;  Response: $(echo &quot;$RETRY_RESP&quot; | head -1)&quot;<br>      fi<br><br>    elif echo &quot;$APPLY_BODY&quot; | grep -qi &quot;deprecated&quot;; then<br>      # Deprecated version — look up latest version in Exchange and retry<br>      echo &quot;  Policy &#39;${POLICY_ASSET_ID}&#39; v${POLICY_ASSET_VER} is deprecated — finding latest version in Exchange...&quot;<br>      LATEST_VER=$(curl -s --max-time 15 \<br>        &quot;https://anypoint.mulesoft.com/exchange/api/v2/assets/${POLICY_GROUP_ID}/${POLICY_ASSET_ID}&quot; \<br>        -H &quot;Authorization: Bearer ${ACCESS_TOKEN}&quot; | jq -r &#39;.version // empty&#39;)<br>      if [ -z &quot;$LATEST_VER&quot; ]; then<br>        echo &quot;  WARNING: Could not find latest version for &#39;${POLICY_ASSET_ID}&#39; in Exchange. Apply manually.&quot;<br>      elif [ &quot;$LATEST_VER&quot; == &quot;$POLICY_ASSET_VER&quot; ]; then<br>        echo &quot;  WARNING: &#39;${POLICY_ASSET_ID}&#39; v${POLICY_ASSET_VER} is the latest but still deprecated. Apply manually.&quot;<br>      else<br>        echo &quot;  Retrying &#39;${POLICY_ASSET_ID}&#39; with latest version ${LATEST_VER}...&quot;<br>        RETRY_RESP=$(curl -s --max-time 30 -w &quot;\n%{http_code}&quot; -X POST \<br>          &quot;https://anypoint.mulesoft.com/apimanager/api/v1/organizations/${ANYPOINT_ORG_ID}/environments/${ANYPOINT_ENV_ID}/apis/${NEW_INSTANCE_ID}/policies&quot; \<br>          -H &quot;Authorization: Bearer ${ACCESS_TOKEN}&quot; -H &quot;Content-Type: application/json&quot; \<br>          -d &quot;{\&quot;assetId\&quot;:\&quot;${POLICY_ASSET_ID}\&quot;,\&quot;assetVersion\&quot;:\&quot;${LATEST_VER}\&quot;,\&quot;groupId\&quot;:\&quot;${POLICY_GROUP_ID}\&quot;,\&quot;configurationData\&quot;:${JSON_CONFIG}}&quot;)<br>        RETRY_CODE=$(echo &quot;$RETRY_RESP&quot; | tail -1)<br>        RETRY_BODY=$(echo &quot;$RETRY_RESP&quot; | head -1)<br>        if [ &quot;$RETRY_CODE&quot; -eq 201 ] || [ &quot;$RETRY_CODE&quot; -eq 200 ]; then<br>          NEW_POLICY_ID=$(echo &quot;$RETRY_BODY&quot; | jq -r &#39;.id&#39;)<br>          echo &quot;  Policy &#39;${POLICY_ASSET_ID}&#39; applied as v${LATEST_VER} (upgraded from v${POLICY_ASSET_VER}, ID: ${NEW_POLICY_ID}).&quot;<br>          apply_pointcut &quot;$NEW_INSTANCE_ID&quot; &quot;$NEW_POLICY_ID&quot; &quot;$POINTCUT_DATA&quot; &quot;$ACCESS_TOKEN&quot; &quot;$POLICY_ASSET_ID&quot;<br>        else<br>          echo &quot;  WARNING: &#39;${POLICY_ASSET_ID}&#39; with latest version ${LATEST_VER} also failed (HTTP ${RETRY_CODE}).&quot;<br>          echo &quot;  Response: ${RETRY_BODY}&quot;<br>        fi<br>      fi<br><br>    else<br>      echo &quot;  WARNING: Policy &#39;${POLICY_ASSET_ID}&#39; returned HTTP ${HTTP_CODE}.&quot;<br>      echo &quot;  Response: ${APPLY_BODY}&quot;<br>    fi<br>  done<br>fi<br><br>echo &quot;==========================================================&quot;<br>echo &quot;API instance created. Policies cloned.&quot;<br>echo &quot;Target API Instance ID: $NEW_INSTANCE_ID&quot;<br>echo &quot;==========================================================&quot;<br><br># ---------------------------------------------------------------------------<br># STEP 5 — Clone approved contracts<br># ---------------------------------------------------------------------------<br>echo &quot;[5/5] Retrieving approved contracts from source API (${ORIGINAL_API_ID})...&quot;<br><br>CONTRACTS_JSON=$(curl -s \<br>  &quot;https://anypoint.mulesoft.com/apimanager/api/v1/organizations/${ANYPOINT_ORG_ID}/environments/${ANYPOINT_ENV_ID}/apis/${ORIGINAL_API_ID}/contracts&quot; \<br>  -H &quot;Authorization: Bearer ${ACCESS_TOKEN}&quot;)<br><br>APPROVED_APP_IDS=$(echo &quot;$CONTRACTS_JSON&quot; | jq -r &#39;.contracts[] | select(.status==&quot;APPROVED&quot;) | .applicationId&#39;)<br><br>if [ -z &quot;$APPROVED_APP_IDS&quot; ]; then<br>  echo &quot;No approved contracts found on the source API.&quot;<br>else<br>  echo &quot;Approved contracts found. Starting contract cloning...&quot;<br>  for APP_ID in $APPROVED_APP_IDS; do<br>    APP_NAME=$(echo &quot;$CONTRACTS_JSON&quot; | jq -r &quot;.contracts[] | select(.applicationId==$APP_ID) | .application.name&quot; | head -n 1)<br>    echo &quot;  Creating contract for: ${APP_NAME} (ID: ${APP_ID})...&quot;<br>    RESPONSE=$(curl -s -o /dev/null -w &quot;%{http_code}&quot; -X POST \<br>      &quot;https://anypoint.mulesoft.com/apimanager/api/v1/organizations/${ANYPOINT_ORG_ID}/environments/${ANYPOINT_ENV_ID}/apis/${NEW_INSTANCE_ID}/contracts&quot; \<br>      -H &quot;Authorization: Bearer ${ACCESS_TOKEN}&quot; -H &quot;Content-Type: application/json&quot; \<br>      -d &quot;{\&quot;applicationId\&quot;:${APP_ID},\&quot;acceptedTerms\&quot;:true}&quot;)<br>    if [ &quot;$RESPONSE&quot; -eq 201 ] || [ &quot;$RESPONSE&quot; -eq 200 ]; then<br>      echo &quot;  Contract created for &#39;${APP_NAME}&#39;.&quot;<br>    else<br>      echo &quot;  ERROR: Failed contract for &#39;${APP_NAME}&#39; (HTTP $RESPONSE).&quot;<br>    fi<br>  done<br>fi<br><br>echo &quot;==========================================================&quot;<br>echo &quot;CLONING COMPLETE&quot;<br>echo &quot;Source API Instance  : $ORIGINAL_API_ID&quot;<br>echo &quot;Target API Instance  : $NEW_INSTANCE_ID&quot;<br>echo &quot;Environment          : $ANYPOINT_ENV_NAME ($ANYPOINT_ENV_ID)&quot;<br>echo &quot;==========================================================&quot;</pre><h4><strong>Step 0 — OAuth2 Bearer Token</strong></h4><p>The script authenticates using the <strong>**OAuth2 `client_credentials` grant**</strong> against Anypoint’s token endpoint.</p><blockquote>This is the correct approach for non-interactive, service-to-service automation: a <strong>Connected App</strong> is used instead of a user account, making the script compatible with CI/CD environments and secrets managers (AWS Secrets Manager, Vault, etc.).</blockquote><p>The token is validated immediately — if it comes back null or empty, the script exits with a clear error rather than propagating a bad token through 200+ lines of subsequent API calls.</p><h4><strong>Step 1 — Environment Confirmation</strong></h4><p>Rather than a real API call, Step 1 is intentionally just a confirmation print. This is good UX for pipeline logs: the operator can verify at a glance that the correct environment UUID is in scope before any mutating operations begin.</p><h4><strong>Step 2 — Source API Introspection and Instance Creation</strong></h4><p>The script reads the source API instance’s endpoint configuration.</p><blockquote>Notice the use of `// “”` and `// false` — jq’s <strong>null-coalescing operator</strong> — on every extracted field. This prevents `null` strings from being injected into the downstream JSON payload, a subtle but important defensive detail.</blockquote><p>The new instance is created via `POST /apis` using `jq -n` with ` — arg` named parameters, avoiding any risk of shell variable injection into the JSON body. This is the correct pattern for programmatic JSON construction in Bash — using `jq -n` rather than building JSON through string concatenation eliminates an entire class of escaping bugs.</p><h4><strong>Step 3 — Policy Retrieval via Anypoint CLI</strong></h4><p>Here the script makes a deliberate architectural choice: <strong>it uses `anypoint-cli-v4` rather than the REST API</strong> to read policies from the source instance.</p><p>The comment at the top of the script explains the reasoning explicitly:</p><p>&gt; `POLICY READING: anypoint-cli-v4 stored user session (reads ALL policy types)`</p><p>This is an important insight into an Anypoint Platform limitation: the REST API, when called with Connected App credentials, <strong>does not return all policy types </strong>for certain policy categories (notably automated policies and some MuleSoft-provided policies).</p><p>The CLI, which operates against the user’s stored session, has broader read access. The `2&gt;/dev/null` redirect suppresses the CLI’s progress/banner output so only the JSON result is captured.</p><h4><strong>Step 4 — Policy Application with Three-Path Error Handling</strong></h4><p>This is the most sophisticated part of the script. For each policy, it attempts a `POST` to apply it, then handles three distinct failure scenarios:</p><p><strong>Path A: Success (HTTP 200/201)</strong></p><p>Normal path. The new policy ID is captured and, if the source had `pointcutData` conditions, a subsequent `PATCH` applies them.</p><p><strong>Path B: Missing Secret Field (`missingProperty`)</strong></p><p>Some policies (JWT validation, OAuth2, client secret enforcement) contain secret values. The Anypoint API returns the field name but <strong>**redacts the value**</strong> when you read the policy — by design, for security reasons. The script detects this condition by inspecting the error response.</p><p>Rather than failing and aborting, it <strong>injects a placeholder value</strong> so the policy is still created (and thus included in API Manager’s routing logic). It then prints a clearly marked `ACTION REQUIRED` warning so the operator knows exactly which policies need manual secret entry.</p><blockquote>This is pragmatic: a policy with a placeholder secret is better than no policy at all during an environment bootstrap, because the API instance is not left in an inconsistent state.</blockquote><p><strong>#Path C: Deprecated Policy Version</strong></p><p>If the policy version attached to the source is deprecated in Exchange the script queries the Exchange API to find the current latest version and retries the apply with the upgraded version. This handles the common situation where a legacy environment was running an older policy version that has since been deprecated in the platform catalog.</p><h4><strong>Step 5 — Contract Cloning</strong></h4><p>The final step replicates all <strong>approved</strong> client application contracts from the source to the new instance. Filtering to `APPROVED` status only is the right policy — pending or revoked contracts on the source should not be automatically re-created on the new instance.</p><h4><strong>Security Model</strong></h4><p>The script follows secure credential practices. This is MuleSoft’s well-known, stable Exchange group ID for platform-provided policies — it is the same across all Anypoint organizations.</p><p>While it is not a secret, hardcoding it means the script will not work for custom policies published under a different organization’s group ID. Making this an environment variable or a CLI parameter would increase flexibility.</p><p><strong>The Inline YAML-to-JSON Parser</strong></p><p>The policy configuration returned by the CLI comes back as YAML. The script converts it to JSON using an inline Node.js one-liner.</p><p><strong>This is functional but limited</strong>. It handles the two most common YAML patterns: simple `key: value` pairs and flat `key: [list]` arrays. It will not correctly handle nested objects, multi-line strings, quoted values, or anchors. For the policy configuration payloads that Anypoint Manager typically emits, this is sufficient — but it is a fragile point worth noting.</p><p>A more robust alternative would be to install `yq` (the YAML-to-JSON CLI tool) or use `python3 -c “import sys, yaml, json; print(json.dumps(yaml.safe_load(sys.stdin)))”` which handles the full YAML spec.</p><h4><strong>Known Limitations and Improvement Opportunities</strong></h4><p><strong>1. No Idempotency / Duplicate Detection</strong></p><p>Running the script twice against the same source and target will create a second API Manager instance. There is no check for an existing instance with the same `instanceLabel` and asset version. Adding an existence check before the `POST /apis` call would make the script safely re-runnable.</p><p><strong>2. Disabled Policies Are Not Re-Disabled</strong></p><p>The script detects when a source policy has `Status: Disabled` and logs a note. However, the API does support disabling a policy programmatically via `PATCH /policies/{id}` with `{“disabled”: true}`. Automating this would complete the fidelity of the clone.</p><p><strong>3. Policies with Multiple Missing Secret Fields</strong></p><p>The `missingProperty` retry path only handles a single missing field per policy. If a policy requires two secret fields, the second call will fail again with a different `missingProperty`. A production hardening would loop the placeholder injection until all missing fields are filled.</p><p><strong>4. No Dry-Run Mode</strong></p><p>Adding a ` dry-run` flag that reads and prints what would be created — without making any `POST` calls — would greatly aid testing and audit workflows before running against production.</p><p><strong>5. Single-Environment Scope</strong></p><p>The script clones within a single environment (source and target are in the same `ANYPOINT_ENV_ID`). Cloning across environments (e.g., from `Sandbox` to `Production`) would require parameterizing both source and target environment IDs separately.</p><p><strong>6. Token Expiry on Long Runs</strong></p><p>Bearer tokens from Connected Apps have a finite lifetime (typically 60 minutes). For organizations with hundreds of APIs and policies, a very long run could hit token expiry mid-execution. Adding a token refresh check before each major API call would guard against this.</p><h4><strong>Conclusion</strong></h4><p>This script is a well-structured automation for a task that the Anypoint Platform UI does not natively support: full API Manager instance cloning including policies and contracts.</p><p>The script’s limitations are real but bounded — no idempotency, a simplistic YAML parser, single missing-secret handling — and all are fixable without restructuring the core design.</p><p>As written, it already covers the 95% case for automating API environment promotion or multi-deployment-target setup on Anypoint Platform.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=637a1b6725d1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/another-integration-blog/deep-dive-automating-anypoint-api-manager-instance-cloning-with-bash-637a1b6725d1">Deep Dive: Automating Anypoint API Manager Instance Cloning with Bash</a> was originally published in <a href="https://medium.com/another-integration-blog">Another Integration Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MuleSoft Vibes: A Complete Beginner’s Guide]]></title>
            <link>https://medium.com/another-integration-blog/mulesoft-vibes-a-complete-beginners-guide-3682755e1170?source=rss-5a200f51912e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3682755e1170</guid>
            <category><![CDATA[mulesoft]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[mulesoftvibes]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Martina Huzanic]]></dc:creator>
            <pubDate>Thu, 23 Jul 2026 00:01:53 GMT</pubDate>
            <atom:updated>2026-07-23T00:01:53.530Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, you’ll learn what MuleSoft Vibes is, why it matters, how to install it, configure it, and start using it effectively.</p><h3>What is MuleSoft Vibes?</h3><p>MuleSoft Vibes is an <strong>AI assistant designed specifically for MuleSoft</strong> developers.</p><p>It works inside <strong>Anypoint Code Builder</strong>, allowing developers to build, modify, test, and even deploy applications using conversational prompts.</p><p>Vibes also integrates with MuleSoft MCP (Model Context Protocol) Servers to perform actions securely within your MuleSoft environment.</p><p>Because Vibes is integrated into the MuleSoft ecosystem, it understands platform-specific concepts that general AI assistants may not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OdHZZRRmr3-ZYxBnkvLryw.png" /></figure><h3>Key capabilities :</h3><ul><li>Generate Mule applications from natural language</li><li>Create API specifications</li><li>Generate DataWeave transformations</li><li>Build MUnit tests</li><li>Explain existing Mule code</li><li>Analyze project structure</li><li>Search reusable assets</li><li>Help troubleshoot errors</li></ul><h3>Prerequisites</h3><p>Before installing MuleSoft Vibes, ensure you have:</p><ul><li>An Anypoint Platform account with required permissions (such as Mule Developer Generative AI access)</li><li>Access to Anypoint Code Builder</li></ul><blockquote>Authentication is handled through your logged-in Anypoint account, and Vibes inherits your existing permissions.</blockquote><h3>Step 1: Install Anypoint Code Builder</h3><ol><li>Download and install Anypoint Code Builder.</li><li>Install Anypoint Extension pack</li><li>Sign in using your Anypoint Platform credentials. (After logging in, your MuleSoft projects become available)</li></ol><h3>Step 2: Enable MuleSoft Vibes</h3><p>Once ACB is installed and your organization has enabled AI permissions, Vibes becomes available automatically.</p><ol><li>Locate the <strong>MuleSoft Vibes</strong> icon in the toolbar and click the icon.</li><li>Open any Mule project and you should be able to start a new task.</li></ol><h3>Step 3: Configure Settings</h3><p>Before using it be sure to open the Vibes settings panel and configure options such as:</p><ul><li>Auto-approve file changes</li><li>Confirmation before edits</li><li>Workspace permissions</li><li>MCP Server configuration</li></ul><p>Many teams prefer keeping approvals enabled until they are comfortable with the generated code. So, start from there…</p><h3>Your First Prompt</h3><p>After setup, try prompts like:</p><ul><li>Create a Mule application that reads from Salesforce and writes to SAP.</li><li>Write a DataWeave transformation from a to b.</li><li>Create MUnit tests for flow xyz</li><li>Optimize this Mule flow for better performance…</li></ul><blockquote>Vibes analyzes your project before generating code, making its suggestions more aligned with your application’s structure. Beyond code generation, <strong>it can read and explain virtually every part of an existing Mule application</strong>, including flows, DataWeave scripts, configurations, and connectors.</blockquote><blockquote>This is especially valuable when you’re inheriting an older, poorly structured API with little or no documentation. Instead of spending hours tracing complex flows manually, you can ask Vibes to explain how a flow works, identify dependencies, or summarize the application’s behavior. This can save a significant amount of time and help developers become productive much faster on legacy MuleSoft projects.</blockquote><blockquote><strong>To get the best results be specific in your prompts.</strong></blockquote><p>Attach relevant project files before asking for changes. Review generated code before committing it. Break large requests into smaller tasks and be sure to use version control to track AI-generated changes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3682755e1170" width="1" height="1" alt=""><hr><p><a href="https://medium.com/another-integration-blog/mulesoft-vibes-a-complete-beginners-guide-3682755e1170">MuleSoft Vibes: A Complete Beginner’s Guide</a> was originally published in <a href="https://medium.com/another-integration-blog">Another Integration Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RAML API Fragment for Standardized Error Handling — p2]]></title>
            <link>https://medium.com/@martinahuzanic/raml-api-fragment-for-standardized-error-handling-p2-360582ee16a1?source=rss-5a200f51912e------2</link>
            <guid isPermaLink="false">https://medium.com/p/360582ee16a1</guid>
            <category><![CDATA[mulesoft]]></category>
            <category><![CDATA[error-handling]]></category>
            <dc:creator><![CDATA[Martina Huzanic]]></dc:creator>
            <pubDate>Mon, 15 Jun 2026 07:02:01 GMT</pubDate>
            <atom:updated>2026-06-15T07:02:01.646Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>reusable-error-handling-components.xml</strong></p><ol><li>Standard Error Response Builder: Automated error code mapping and categorization</li><li>Enhanced Logging Sub-flows: Structured error logging with correlation tracking</li><li>Audit Logging: Standardized audit trail integration</li><li>CloudHub Notifications: Intelligent notification handling</li></ol><p>5. Complete Error Handler Templates: Ready-to-use for APIs and batch processes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*Xz-mJq2gLX-DXJbETRZqOQ.png" /></figure><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br><br>&lt;mule xmlns:sqs=&quot;http://www.mulesoft.org/schema/mule/sqs&quot;<br>    xmlns:cloudhub=&quot;http://www.mulesoft.org/schema/mule/cloudhub&quot;<br>    xmlns:ee=&quot;http://www.mulesoft.org/schema/mule/ee/core&quot;<br>    xmlns:vm=&quot;http://www.mulesoft.org/schema/mule/vm&quot;<br>    xmlns=&quot;http://www.mulesoft.org/schema/mule/core&quot;<br>    xmlns:doc=&quot;http://www.mulesoft.org/schema/mule/documentation&quot;<br>    xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>    xsi:schemaLocation=&quot;<br>http://www.mulesoft.org/schema/mule/sqs http://www.mulesoft.org/schema/mule/sqs/current/mule-sqs.xsd<br>http://www.mulesoft.org/schema/mule/cloudhub http://www.mulesoft.org/schema/mule/cloudhub/current/mule-cloudhub.xsd<br>http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd<br>http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd<br>http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd&quot;&gt;<br><br>    &lt;!-- ===================================== --&gt;<br>    &lt;!-- REUSABLE ERROR HANDLING COMPONENTS   --&gt;<br>    &lt;!-- ===================================== --&gt;<br><br>    &lt;!-- Standard Error Response Builder --&gt;<br>    &lt;sub-flow name=&quot;build-standard-error-response&quot; doc:id=&quot;build-standard-error-response&quot;&gt;<br>        &lt;ee:transform doc:name=&quot;Build Standard Error Response&quot; doc:id=&quot;build-standard-error-response-transform&quot;&gt;<br>            &lt;ee:message&gt;<br>                &lt;ee:set-payload&gt;&lt;![CDATA[%dw 2.0<br>output application/json<br><br>import * from dw::core::Strings<br><br>var errorCodeMapping = {<br>    // Business Errors<br>    &quot;VALIDATION:INVALID_BOOLEAN&quot;: &quot;VAL_001&quot;,<br>    &quot;VALIDATION:NULL&quot;: &quot;VAL_002&quot;, <br>    &quot;VALIDATION:NOT_EMPTY_COLLECTION&quot;: &quot;VAL_003&quot;,<br>    &quot;VALIDATION:IS_EMPTY_COLLECTION&quot;: &quot;VAL_004&quot;,<br>    &quot;APP:MISSING_BRAND_AUTH&quot;: &quot;BUS_001&quot;,<br>    &quot;APP:INVALID_BRAND_AUTH&quot;: &quot;BUS_002&quot;,<br>    &quot;APP:MISSING_COUNTRY&quot;: &quot;BUS_003&quot;,<br>    &quot;APP:INVALID_COUNTRY&quot;: &quot;BUS_004&quot;,<br>    &quot;APP:STOP_FILE&quot;: &quot;BUS_005&quot;,<br>    &quot;APP:WORK_FILE&quot;: &quot;BUS_006&quot;,<br>    &quot;APP:BULK_JOB_STATE_ERROR&quot;: &quot;BUS_007&quot;,<br>    &quot;APP:PUBLISH_CONSUMER_FLOW_ERROR&quot;: &quot;BUS_008&quot;,<br>    <br>    // Technical Errors  <br>    &quot;HTTP:CONNECTIVITY&quot;: &quot;TECH_001&quot;,<br>    &quot;HTTP:TIMEOUT&quot;: &quot;TECH_002&quot;,<br>    &quot;HTTP:UNAUTHORIZED&quot;: &quot;TECH_003&quot;,<br>    &quot;HTTP:FORBIDDEN&quot;: &quot;TECH_004&quot;,<br>    &quot;HTTP:NOT_FOUND&quot;: &quot;TECH_005&quot;,<br>    &quot;HTTP:INTERNAL_SERVER_ERROR&quot;: &quot;TECH_006&quot;,<br>    &quot;DB:CONNECTIVITY&quot;: &quot;TECH_007&quot;,<br>    &quot;DB:QUERY_EXECUTION&quot;: &quot;TECH_008&quot;,<br>    &quot;S3:CONNECTIVITY&quot;: &quot;TECH_009&quot;,<br>    &quot;S3:ACCESS_DENIED&quot;: &quot;TECH_010&quot;,<br>    &quot;SFC:JOB_PROCESSING_ERROR&quot;: &quot;TECH_011&quot;,<br>    &quot;BIGQUERY:CONNECTIVITY&quot;: &quot;TECH_012&quot;,<br>    &quot;BIGQUERY:BAD_REQUEST&quot;: &quot;TECH_013&quot;,<br>    <br>    // System Errors<br>    &quot;APIKIT:BAD_REQUEST&quot;: &quot;SYS_001&quot;,<br>    &quot;APIKIT:NOT_FOUND&quot;: &quot;SYS_002&quot;, <br>    &quot;APIKIT:METHOD_NOT_ALLOWED&quot;: &quot;SYS_003&quot;,<br>    &quot;APIKIT:NOT_ACCEPTABLE&quot;: &quot;SYS_004&quot;,<br>    &quot;APIKIT:UNSUPPORTED_MEDIA_TYPE&quot;: &quot;SYS_005&quot;,<br>    &quot;APIKIT:NOT_IMPLEMENTED&quot;: &quot;SYS_006&quot;<br>}<br><br>var errorCategoryMapping = {<br>    &quot;VAL&quot;: &quot;VALIDATION&quot;,<br>    &quot;BUS&quot;: &quot;BUSINESS&quot;, <br>    &quot;TECH&quot;: &quot;TECHNICAL&quot;,<br>    &quot;SYS&quot;: &quot;SYSTEM&quot;<br>}<br><br>var errorCode = errorCodeMapping[error.errorType.identifier] default &quot;GEN_001&quot;<br>var errorCategory = errorCategoryMapping[errorCode splitBy &quot;_&quot; take 1 joinBy &quot;&quot;] default &quot;GENERAL&quot;<br><br>var httpStatusMapping = {<br>    &quot;VALIDATION&quot;: 400,<br>    &quot;BUSINESS&quot;: 422,<br>    &quot;TECHNICAL&quot;: 502,<br>    &quot;SYSTEM&quot;: vars.httpStatus default 500,<br>    &quot;GENERAL&quot;: 500<br>}<br><br>var httpStatus = httpStatusMapping[errorCategory] default 500<br><br>---<br>{<br>    error: {<br>        code: errorCode,<br>        category: errorCategory,<br>        message: vars.customErrorMessage default error.description default &quot;An error occurred&quot;,<br>        details: error.detailedDescription default null,<br>        timestamp: now() as String {format: &quot;yyyy-MM-dd&#39;T&#39;HH:mm:ss&#39;Z&#39;&quot;},<br>        correlationId: vars.correlationId default attributes.headers.&quot;correlation-id&quot; default correlationId,<br>        path: vars.pathName default attributes.relativePath default null,<br>        method: vars.inputAttributes.method default attributes.method default null,<br>        errorType: error.errorType.identifier default null<br>    },<br>    meta: {<br>        apiName: app.name,<br>        apiVersion: p(&#39;api.version&#39;) default &quot;1.0.0&quot;,<br>        environment: p(&#39;environment&#39;) default mule.env default &quot;unknown&quot;,<br>        nodeId: mule.nodeId default null<br>    }<br>}]]&gt;&lt;/ee:set-payload&gt;<br>            &lt;/ee:message&gt;<br>            &lt;ee:variables&gt;<br>                &lt;ee:set-variable variableName=&quot;httpStatus&quot;&gt;&lt;![CDATA[%dw 2.0<br>output application/java<br><br>import * from dw::core::Strings<br><br>var errorCode = payload.error.code<br>var errorCategory = errorCode splitBy &quot;_&quot; take 1 joinBy &quot;&quot;<br><br>var httpStatusMapping = {<br>    &quot;VAL&quot;: 400,    // Validation errors -&gt; Bad Request<br>    &quot;BUS&quot;: 422,    // Business errors -&gt; Unprocessable Entity  <br>    &quot;TECH&quot;: 502,   // Technical errors -&gt; Bad Gateway<br>    &quot;SYS&quot;: vars.httpStatus default 500,  // System errors -&gt; use existing or Internal Server Error<br>    &quot;GEN&quot;: 500     // General errors -&gt; Internal Server Error<br>}<br>---<br>httpStatusMapping[errorCategory] default 500]]&gt;&lt;/ee:set-variable&gt;<br>            &lt;/ee:variables&gt;<br>        &lt;/ee:transform&gt;<br>    &lt;/sub-flow&gt;<br><br>    &lt;!-- Enhanced Logging Sub-flow --&gt;<br>    &lt;sub-flow name=&quot;enhanced-error-logging&quot; doc:id=&quot;enhanced-error-logging&quot;&gt;<br>        &lt;logger level=&quot;ERROR&quot; doc:name=&quot;Structured Error Log&quot; doc:id=&quot;structured-error-log&quot;&gt;<br>            &lt;logger:message&gt;&lt;![CDATA[#[%dw 2.0<br>output application/json<br>---<br>{<br>    level: &quot;ERROR&quot;,<br>    timestamp: now() as String {format: &quot;yyyy-MM-dd&#39;T&#39;HH:mm:ss&#39;Z&#39;&quot;},<br>    correlationId: vars.correlationId default attributes.headers.&quot;correlation-id&quot; default correlationId,<br>    application: app.name,<br>    environment: p(&#39;environment&#39;) default mule.env,<br>    flow: flow.name default &quot;unknown&quot;,<br>    error: {<br>        code: payload.error.code default null,<br>        category: payload.error.category default null,<br>        message: payload.error.message default null,<br>        details: payload.error.details default null,<br>        type: payload.error.errorType default null<br>    },<br>    request: {<br>        method: vars.inputAttributes.method default attributes.method default null,<br>        path: vars.pathName default attributes.relativePath default null,<br>        headers: (vars.inputAttributes.headers default attributes.headers default {}) -- [&quot;authorization&quot;, &quot;client_id&quot;, &quot;client_secret&quot;],<br>        queryParams: vars.inputAttributes.queryParams default attributes.queryParams default {}<br>    },<br>    performance: {<br>        responseTime: if (vars.startTimeMs != null) (now() as Number {unit: &quot;milliseconds&quot;}) - vars.startTimeMs else null<br>    }<br>}]]]&gt;&lt;/logger:message&gt;<br>        &lt;/logger&gt;<br>    &lt;/sub-flow&gt;<br><br>    &lt;!-- Audit Logging Sub-flow --&gt;<br>    &lt;sub-flow name=&quot;enhanced-audit-logging&quot; doc:id=&quot;enhanced-audit-logging&quot;&gt;<br>        &lt;ee:transform doc:name=&quot;Build Audit Message&quot; doc:id=&quot;build-audit-message&quot;&gt;<br>            &lt;ee:message&gt;<br>                &lt;ee:set-payload&gt;&lt;![CDATA[%dw 2.0<br>output application/json<br><br>var httpStatus = vars.httpStatus as String default &quot;500&quot;<br>var flowService = (vars.inputAttributes.method default attributes.method default &quot;&quot;) ++ &quot; &quot; ++ <br>                  (app.name default &quot;_&quot;) ++ <br>                  (vars.pathName default attributes.relativePath default &quot;_&quot;)<br>var loggingType = p(&#39;log.type.error&#39;) default &quot;DB&quot;<br>var serviceType = if (attributes.listenerPath != null) &quot;API&quot; else &quot;Batch&quot;<br>var status = &quot;error&quot;<br>var header = (vars.inputAttributes.headers default attributes.headers default {}) -- [&quot;authorization&quot;, &quot;client_id&quot;, &quot;client_secret&quot;]<br>var inputPayload = if (vars.inputPayload != null) <br>                    write(vars.inputPayload, &quot;application/json&quot;, {indent:false}) as String <br>                   else null<br>var outputPayload = write(payload, &quot;application/json&quot;, {indent:false}) as String<br>var user = &quot;MuleUser&quot;<br>var responseTime = if (vars.startTimeMs != null) (now() as Number {unit: &quot;milliseconds&quot;}) - vars.startTimeMs else null<br>var flagReqResp = &quot;0&quot; // 0 = response, 1 = request<br><br>---<br>{<br>    key_type: p(&#39;audit.key_type.error&#39;) default 1,<br>    key_1: payload.error.code default null,<br>    key_2: payload.error.category default null,<br>    key_3: flow.name default null,<br>    key_4: httpStatus,<br>    source_system: app.name default null,<br>    target_system: &quot;ERROR_HANDLER&quot;,<br>    flowService: flowService,<br>    loggingType: loggingType,<br>    serviceType: serviceType,<br>    status: status,<br>    uniqueID: vars.correlationId default attributes.headers.&quot;correlation-id&quot; default correlationId,<br>    header: header,<br>    inputPayload: inputPayload,<br>    outputPayload: outputPayload,<br>    user: user,<br>    responseTime: responseTime,<br>    flagReqResp: flagReqResp,<br>    errorCode: payload.error.code default null,<br>    errorMessage: payload.error.message default null,<br>    errorDetails: payload.error.details default null<br>}]]&gt;&lt;/ee:set-payload&gt;<br>            &lt;/ee:message&gt;<br>        &lt;/ee:transform&gt;<br>        &lt;choice doc:name=&quot;Should Log?&quot; doc:id=&quot;should-log-choice&quot;&gt;<br>            &lt;when expression=&quot;#[payload.loggingType != &#39;none&#39; and payload.loggingType != &#39;&#39; and payload.loggingType != null]&quot;&gt;<br>                &lt;vm:publish doc:name=&quot;Publish to audit queue&quot; doc:id=&quot;publish-audit-queue&quot; <br>                           config-ref=&quot;vmAuditConfig&quot; queueName=&quot;queue-audit-error&quot; /&gt;<br>            &lt;/when&gt;<br>        &lt;/choice&gt;<br>    &lt;/sub-flow&gt;<br><br>    &lt;!-- CloudHub Notification Sub-flow --&gt;<br>    &lt;sub-flow name=&quot;enhanced-cloudhub-notification&quot; doc:id=&quot;enhanced-cloudhub-notification&quot;&gt;<br>        &lt;choice doc:name=&quot;Should Notify?&quot; doc:id=&quot;should-notify-choice&quot;&gt;<br>            &lt;when expression=&quot;#[p(&#39;cloudhub.notifications.enabled&#39;) default &#39;true&#39; == &#39;true&#39;]&quot;&gt;<br>                &lt;cloudhub:create-notification <br>                    doc:name=&quot;Enhanced CloudHub Notification&quot; <br>                    doc:id=&quot;enhanced-cloudhub-notification-create&quot;<br>                    domain=&quot;#[app.name]&quot; <br>                    priority=&quot;#[if (payload.error.category == &#39;TECHNICAL&#39; or payload.error.category == &#39;SYSTEM&#39;) &#39;ERROR&#39; else &#39;WARN&#39;]&quot;<br>                    transactionId=&quot;#[payload.error.correlationId default uuid()]&quot;<br>                    config-ref=&quot;cloudhubConfig&quot;&gt;<br>                    &lt;cloudhub:message&gt;&lt;![CDATA[#[p(&#39;app.cloudhub.alert.filter&#39;) ++ &#39;: &#39; ++ payload.error.message]]]&gt;&lt;/cloudhub:message&gt;<br>                    &lt;cloudhub:custom-properties&gt;&lt;![CDATA[#[output application/java<br>---<br>{<br>    correlationId: payload.error.correlationId,<br>    errorCode: payload.error.code,<br>    errorCategory: payload.error.category,<br>    errorMessage: payload.error.message,<br>    errorDetails: payload.error.details,<br>    apiName: payload.meta.apiName,<br>    environment: payload.meta.environment,<br>    timestamp: payload.error.timestamp,<br>    path: payload.error.path,<br>    method: payload.error.method<br>}]]]&gt;&lt;/cloudhub:custom-properties&gt;<br>                &lt;/cloudhub:create-notification&gt;<br>            &lt;/when&gt;<br>        &lt;/choice&gt;<br>    &lt;/sub-flow&gt;<br><br>    &lt;!-- Complete Error Handling Sub-flow --&gt;<br>    &lt;sub-flow name=&quot;handle-error-complete&quot; doc:id=&quot;handle-error-complete&quot;&gt;<br>        &lt;flow-ref doc:name=&quot;Build Standard Error Response&quot; doc:id=&quot;ref-build-standard-error-response&quot; <br>                  name=&quot;build-standard-error-response&quot; /&gt;<br>        &lt;flow-ref doc:name=&quot;Enhanced Error Logging&quot; doc:id=&quot;ref-enhanced-error-logging&quot; <br>                  name=&quot;enhanced-error-logging&quot; /&gt;<br>        &lt;flow-ref doc:name=&quot;Enhanced Audit Logging&quot; doc:id=&quot;ref-enhanced-audit-logging&quot; <br>                  name=&quot;enhanced-audit-logging&quot; /&gt;<br>        &lt;flow-ref doc:name=&quot;Enhanced CloudHub Notification&quot; doc:id=&quot;ref-enhanced-cloudhub-notification&quot; <br>                  name=&quot;enhanced-cloudhub-notification&quot; /&gt;<br>    &lt;/sub-flow&gt;<br><br>    &lt;!-- API Error Handler Template --&gt;<br>    &lt;sub-flow name=&quot;api-error-handler-template&quot; doc:id=&quot;api-error-handler-template&quot;&gt;<br>        &lt;error-handler name=&quot;standardApiErrorHandler&quot; doc:id=&quot;standard-api-error-handler&quot;&gt;<br>            &lt;on-error-propagate type=&quot;APIKIT:BAD_REQUEST&quot; enableNotifications=&quot;true&quot; logException=&quot;false&quot; <br>                               doc:name=&quot;Bad Request&quot; doc:id=&quot;api-bad-request&quot;&gt;<br>                &lt;set-variable value=&quot;Bad request - invalid input data&quot; doc:name=&quot;Set Custom Message&quot; <br>                             doc:id=&quot;set-bad-request-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-bad-request&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>            <br>            &lt;on-error-propagate type=&quot;APIKIT:NOT_FOUND&quot; enableNotifications=&quot;true&quot; logException=&quot;false&quot;<br>                               doc:name=&quot;Not Found&quot; doc:id=&quot;api-not-found&quot;&gt;<br>                &lt;set-variable value=&quot;Resource not found&quot; doc:name=&quot;Set Custom Message&quot;<br>                             doc:id=&quot;set-not-found-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-not-found&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>            <br>            &lt;on-error-propagate type=&quot;APIKIT:METHOD_NOT_ALLOWED&quot; enableNotifications=&quot;true&quot; logException=&quot;false&quot;<br>                               doc:name=&quot;Method Not Allowed&quot; doc:id=&quot;api-method-not-allowed&quot;&gt;<br>                &lt;set-variable value=&quot;HTTP method not allowed for this resource&quot; doc:name=&quot;Set Custom Message&quot;<br>                             doc:id=&quot;set-method-not-allowed-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-method-not-allowed&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>            <br>            &lt;on-error-propagate type=&quot;APIKIT:NOT_ACCEPTABLE&quot; enableNotifications=&quot;true&quot; logException=&quot;false&quot;<br>                               doc:name=&quot;Not Acceptable&quot; doc:id=&quot;api-not-acceptable&quot;&gt;<br>                &lt;set-variable value=&quot;Requested content type not acceptable&quot; doc:name=&quot;Set Custom Message&quot;<br>                             doc:id=&quot;set-not-acceptable-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-not-acceptable&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>            <br>            &lt;on-error-propagate type=&quot;APIKIT:UNSUPPORTED_MEDIA_TYPE&quot; enableNotifications=&quot;true&quot; logException=&quot;false&quot;<br>                               doc:name=&quot;Unsupported Media Type&quot; doc:id=&quot;api-unsupported-media&quot;&gt;<br>                &lt;set-variable value=&quot;Content type not supported&quot; doc:name=&quot;Set Custom Message&quot;<br>                             doc:id=&quot;set-unsupported-media-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-unsupported-media&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>            <br>            &lt;on-error-propagate type=&quot;APIKIT:NOT_IMPLEMENTED&quot; enableNotifications=&quot;true&quot; logException=&quot;false&quot;<br>                               doc:name=&quot;Not Implemented&quot; doc:id=&quot;api-not-implemented&quot;&gt;<br>                &lt;set-variable value=&quot;Functionality not implemented&quot; doc:name=&quot;Set Custom Message&quot;<br>                             doc:id=&quot;set-not-implemented-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-not-implemented&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>            <br>            &lt;!-- Generic error handler for any unhandled errors --&gt;<br>            &lt;on-error-propagate type=&quot;ANY&quot; enableNotifications=&quot;true&quot; logException=&quot;true&quot;<br>                               doc:name=&quot;Any Other Error&quot; doc:id=&quot;api-any-error&quot;&gt;<br>                &lt;set-variable value=&quot;An unexpected error occurred&quot; doc:name=&quot;Set Custom Message&quot;<br>                             doc:id=&quot;set-any-error-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-any&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>        &lt;/error-handler&gt;<br>    &lt;/sub-flow&gt;<br><br>    &lt;!-- Batch Error Handler Template --&gt;<br>    &lt;sub-flow name=&quot;batch-error-handler-template&quot; doc:id=&quot;batch-error-handler-template&quot;&gt;<br>        &lt;error-handler name=&quot;standardBatchErrorHandler&quot; doc:id=&quot;standard-batch-error-handler&quot;&gt;<br>            &lt;on-error-propagate type=&quot;S3:CONNECTIVITY,S3:ACCESS_DENIED&quot; enableNotifications=&quot;true&quot; logException=&quot;true&quot;<br>                               doc:name=&quot;S3 Errors&quot; doc:id=&quot;batch-s3-errors&quot;&gt;<br>                &lt;set-variable value=&quot;S3 storage system is unavailable&quot; doc:name=&quot;Set Custom Message&quot;<br>                             doc:id=&quot;set-s3-error-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-s3&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>            <br>            &lt;on-error-propagate type=&quot;DB:CONNECTIVITY,DATABASE:CONNECTIVITY&quot; enableNotifications=&quot;true&quot; logException=&quot;true&quot;<br>                               doc:name=&quot;Database Errors&quot; doc:id=&quot;batch-db-errors&quot;&gt;<br>                &lt;set-variable value=&quot;Database system is unavailable&quot; doc:name=&quot;Set Custom Message&quot;<br>                             doc:id=&quot;set-db-error-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-db&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>            <br>            &lt;on-error-propagate type=&quot;SFC:JOB_PROCESSING_ERROR,APP:BULK_JOB_STATE_ERROR&quot; enableNotifications=&quot;true&quot; logException=&quot;true&quot;<br>                               doc:name=&quot;Salesforce Errors&quot; doc:id=&quot;batch-sfc-errors&quot;&gt;<br>                &lt;set-variable value=&quot;Salesforce operation failed&quot; doc:name=&quot;Set Custom Message&quot;<br>                             doc:id=&quot;set-sfc-error-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-sfc&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>            <br>            &lt;on-error-propagate type=&quot;BIGQUERY:CONNECTIVITY,BIGQUERY:BAD_REQUEST&quot; enableNotifications=&quot;true&quot; logException=&quot;true&quot;<br>                               doc:name=&quot;BigQuery Errors&quot; doc:id=&quot;batch-bigquery-errors&quot;&gt;<br>                &lt;set-variable value=&quot;BigQuery service is unavailable&quot; doc:name=&quot;Set Custom Message&quot;<br>                             doc:id=&quot;set-bigquery-error-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-bigquery&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>            <br>            &lt;on-error-propagate type=&quot;APP:STOP_FILE,APP:WORK_FILE&quot; enableNotifications=&quot;true&quot; logException=&quot;false&quot;<br>                               doc:name=&quot;File Control Errors&quot; doc:id=&quot;batch-file-control-errors&quot;&gt;<br>                &lt;set-variable value=&quot;Batch processing control file detected&quot; doc:name=&quot;Set Custom Message&quot;<br>                             doc:id=&quot;set-file-control-error-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-file-control&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>            <br>            &lt;on-error-propagate type=&quot;VALIDATION:INVALID_BOOLEAN,VALIDATION:NULL&quot; enableNotifications=&quot;true&quot; logException=&quot;false&quot;<br>                               doc:name=&quot;Validation Errors&quot; doc:id=&quot;batch-validation-errors&quot;&gt;<br>                &lt;set-variable value=&quot;Data validation failed&quot; doc:name=&quot;Set Custom Message&quot;<br>                             doc:id=&quot;set-validation-error-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-validation&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>            <br>            &lt;!-- Generic error handler for any unhandled errors --&gt;<br>            &lt;on-error-propagate type=&quot;ANY&quot; enableNotifications=&quot;true&quot; logException=&quot;true&quot;<br>                               doc:name=&quot;Any Other Error&quot; doc:id=&quot;batch-any-error&quot;&gt;<br>                &lt;set-variable value=&quot;An unexpected batch processing error occurred&quot; doc:name=&quot;Set Custom Message&quot;<br>                             doc:id=&quot;set-batch-any-error-message&quot; variableName=&quot;customErrorMessage&quot; /&gt;<br>                &lt;flow-ref doc:name=&quot;Handle Error Complete&quot; doc:id=&quot;ref-handle-error-batch-any&quot; <br>                          name=&quot;handle-error-complete&quot; /&gt;<br>            &lt;/on-error-propagate&gt;<br>        &lt;/error-handler&gt;<br>    &lt;/sub-flow&gt;<br><br>&lt;/mule&gt;<br><br></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=360582ee16a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RAML API Fragment for Standardized Error Handling — p1]]></title>
            <link>https://medium.com/@martinahuzanic/raml-api-fragment-for-standardized-error-handling-p1-1a92cd1f5770?source=rss-5a200f51912e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a92cd1f5770</guid>
            <category><![CDATA[mulesoft]]></category>
            <category><![CDATA[design-studio]]></category>
            <category><![CDATA[error-handling]]></category>
            <category><![CDATA[anypoint-platform]]></category>
            <dc:creator><![CDATA[Martina Huzanic]]></dc:creator>
            <pubDate>Wed, 29 Apr 2026 07:39:00 GMT</pubDate>
            <atom:updated>2026-04-29T07:39:00.750Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I’ve created standardized error response formats and handling patterns for consistent API behavior across the organization.</p><h3>Overview</h3><p>This library provides comprehensive, standardized error handling components for MuleSoft applications, ensuring consistent error responses across all APIs in the organization.</p><blockquote>Library defines the structure and format of error responses. It says: “Errors should look like this”.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*cgiCdwkhuiYPWwRbUav0pw.png" /></figure><p>While Library ensures consistency across API ecosystem, you will also need to create XML components that will ensure consistent implementation across MuleSoft applications. But, that will be explained more in p2.</p><blockquote>XML Components will define how to create that error.</blockquote><p>So, together this two will provide end-to-end standardization.</p><h3><strong>1st step is creating RAML Library in Design studio</strong></h3><pre>#%RAML 1.0 Library<br><br>usage: |<br>  This library defines standardized error response formats and handling<br>  patterns for consistent API behavior across the organization.<br><br><br>types:<br>  # Standard Error Response Structure<br>  StandardErrorResponse:<br>    type: object<br>    displayName: Standard Error Response<br>    description: Standardized error response format used across all APIs<br>    properties:<br>      error:<br>        type: ErrorDetails<br>        required: true<br>        description: Error information<br>      meta:<br>        type: MetaInformation<br>        required: true<br>        description: API and environment metadata<br>    example:<br>      error:<br>        code: &quot;CUST_001&quot;<br>        category: &quot;BUSINESS&quot;<br>        message: &quot;Customer validation failed&quot;<br>        details: &quot;Email address format is invalid&quot;<br>        timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>        correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>        path: &quot;/api/v1/customer&quot;<br>        method: &quot;POST&quot;<br>        errorType: &quot;VALIDATION:INVALID_EMAIL&quot;<br>      meta:<br>        apiName: &quot;customer-papi&quot; <br>        apiVersion: &quot;1.0.0&quot;<br>        environment: &quot;prod&quot;<br>        nodeId: &quot;mule-worker-1&quot;<br><br>  # Error Details Structure<br>  ErrorDetails:<br>    type: object<br>    displayName: Error Details<br>    description: Detailed error information<br>    properties:<br>      code:<br>        type: string<br>        required: true<br>        description: Standardized error code (e.g., CUST_001, TECH_001)<br>        pattern: ^[A-Z]{2,4}_\d{3}$<br>        example: &quot;CUST_001&quot;<br>      category:<br>        type: string<br>        required: true<br>        enum: [VALIDATION, BUSINESS, TECHNICAL, SYSTEM, GENERAL]<br>        description: Error category classification<br>        example: &quot;BUSINESS&quot;<br>      message:<br>        type: string<br>        required: true<br>        example: &quot;Customer validation failed&quot;<br>      details:<br>        type: string<br>        required: false<br>        example: &quot;Email address format is invalid&quot;<br>      timestamp:<br>        type: datetime<br>        required: true<br>        example: &quot;2024-01-15T10:30:00Z&quot;<br>      correlationId:<br>        type: string<br>        required: true<br>        example: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>      path:<br>        type: string<br>        required: false<br>        description: The API path that caused the error<br>        example: &quot;/api/v1/customer&quot;<br>      method:<br>        type: string<br>        required: false<br>        enum: [GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS]<br>        description: HTTP method that caused the error<br>        example: &quot;POST&quot;<br>      errorType:<br>        type: string<br>        required: false<br>        example: &quot;VALIDATION:INVALID_EMAIL&quot;<br><br>  # API Metadata Structure<br>  MetaInformation:<br>    type: object<br>    displayName: API Metadata<br>    description: API and environment metadata<br>    properties:<br>      apiName:<br>        type: string<br>        required: true<br>        example: &quot;customer-papi&quot;<br>      apiVersion:<br>        type: string<br>        required: true<br>        example: &quot;1.0.0&quot;<br>      environment:<br>        type: string<br>        required: true<br>        enum: [dev, test, staging, prod]<br>        example: &quot;prod&quot;<br>      nodeId:<br>        type: string<br>        required: false<br>        description: Identifier of the processing node<br>        example: &quot;mule-worker-1&quot;<br><br>  # Validation Error Response (extends StandardErrorResponse)<br>  ValidationErrorResponse:<br>    type: StandardErrorResponse<br>    displayName: Validation Error Response<br>    description: Error response for validation failures<br>    properties:<br>      error:<br>        type: ValidationErrorDetails<br>    example:<br>      error:<br>        code: &quot;VAL_001&quot;<br>        category: &quot;VALIDATION&quot;<br>        message: &quot;Request validation failed&quot;<br>        details: &quot;Required field &#39;email&#39; is missing&quot;<br>        timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>        correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>        path: &quot;/api/v1/customer&quot;<br>        method: &quot;POST&quot;<br>        violations:<br>          - field: &quot;email&quot;<br>            message: &quot;Email is required&quot;<br>            rejectedValue: null<br>          - field: &quot;phone&quot;<br>            message: &quot;Phone number format is invalid&quot;<br>            rejectedValue: &quot;123-abc&quot;<br>      meta:<br>        apiName: &quot;customer-papi&quot;<br>        apiVersion: &quot;1.0.0&quot;<br>        environment: &quot;prod&quot;<br><br>  # Validation Error Details (extends ErrorDetails)<br>  ValidationErrorDetails:<br>    type: ErrorDetails<br>    displayName: Validation Error Details<br>    description: Enhanced error details for validation failures<br>    properties:<br>      violations:<br>        type: ValidationViolation[]<br>        required: false<br>        description: List of specific validation violations<br>        example:<br>          - field: &quot;email&quot;<br>            message: &quot;Email is required&quot;<br>            rejectedValue: null<br><br>  # Validation Violation Structure<br>  ValidationViolation:<br>    type: object<br>    displayName: Validation Violation<br>    description: Individual validation failure details<br>    properties:<br>      field:<br>        type: string<br>        required: true<br>        description: Name of the field that failed validation<br>        example: &quot;email&quot;<br>      message:<br>        type: string<br>        required: true<br>        description: Validation failure message<br>        example: &quot;Email is required&quot;<br>      rejectedValue:<br>        type: any<br>        required: false<br>        description: The value that was rejected<br>        example: null<br><br>traits:<br>  # Standard Error Handling Trait<br>  standardErrorHandling:<br>    displayName: Standard Error Handling<br>    description: |<br>      Applies standard error response formats to API endpoints.<br>      This trait should be applied to all API resources to ensure consistent error handling.<br>    responses:<br>      400:<br>        description: |<br>          Bad Request - The request could not be understood by the server due to malformed syntax.<br>          The client SHOULD NOT repeat the request without modifications.<br>        body:<br>          application/json:<br>            type: ValidationErrorResponse<br>            example:<br>              error:<br>                code: &quot;VAL_001&quot;<br>                category: &quot;VALIDATION&quot;<br>                message: &quot;Request validation failed&quot;<br>                details: &quot;Invalid request format or missing required fields&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer&quot;<br>                method: &quot;POST&quot;<br>                violations:<br>                  - field: &quot;email&quot;<br>                    message: &quot;Email is required&quot;<br>                    rejectedValue: null<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;<br><br>      401:<br>        description: |<br>          Unauthorized - The request requires user authentication or the provided<br>          authentication credentials are invalid.<br>        body:<br>          application/json:<br>            type: StandardErrorResponse<br>            example:<br>              error:<br>                code: &quot;SYS_007&quot;<br>                category: &quot;SYSTEM&quot;<br>                message: &quot;Authentication required&quot;<br>                details: &quot;Valid authentication credentials are required to access this resource&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer&quot;<br>                method: &quot;GET&quot;<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;<br><br>      403:<br>        description: |<br>          Forbidden - The server understood the request but refuses to authorize it.<br>          Re-authenticating will make no difference.<br>        body:<br>          application/json:<br>            type: StandardErrorResponse<br>            example:<br>              error:<br>                code: &quot;SYS_008&quot;<br>                category: &quot;SYSTEM&quot;<br>                message: &quot;Access forbidden&quot;<br>                details: &quot;Insufficient privileges to access this resource&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer&quot;<br>                method: &quot;DELETE&quot;<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;<br><br>      404:<br>        description: |<br>          Not Found - The requested resource could not be found but may be available again in the future.<br>        body:<br>          application/json:<br>            type: StandardErrorResponse<br>            example:<br>              error:<br>                code: &quot;SYS_002&quot;<br>                category: &quot;SYSTEM&quot;<br>                message: &quot;Resource not found&quot;<br>                details: &quot;The requested resource does not exist&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer/12345&quot;<br>                method: &quot;GET&quot;<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;<br><br>      405:<br>        description: |<br>          Method Not Allowed - The HTTP method is not allowed for the requested resource.<br>        body:<br>          application/json:<br>            type: StandardErrorResponse<br>            example:<br>              error:<br>                code: &quot;SYS_003&quot;<br>                category: &quot;SYSTEM&quot;<br>                message: &quot;HTTP method not allowed&quot;<br>                details: &quot;The HTTP method used is not supported for this resource&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer&quot;<br>                method: &quot;PATCH&quot;<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;<br><br>      406:<br>        description: |<br>          Not Acceptable - The requested resource cannot generate content acceptable <br>          according to the Accept headers sent in the request.<br>        body:<br>          application/json:<br>            type: StandardErrorResponse<br>            example:<br>              error:<br>                code: &quot;SYS_004&quot;<br>                category: &quot;SYSTEM&quot;<br>                message: &quot;Not acceptable&quot;<br>                details: &quot;The requested content type is not supported&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer&quot;<br>                method: &quot;GET&quot;<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;<br><br>      415:<br>        description: |<br>          Unsupported Media Type - The request payload format is not supported by this method on the target resource.<br>        body:<br>          application/json:<br>            type: StandardErrorResponse<br>            example:<br>              error:<br>                code: &quot;SYS_005&quot;<br>                category: &quot;SYSTEM&quot;<br>                message: &quot;Unsupported media type&quot;<br>                details: &quot;The request content type is not supported&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer&quot;<br>                method: &quot;POST&quot;<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;<br><br>      422:<br>        description: |<br>          Unprocessable Entity - The request was well-formed but contains semantic errors <br>          that prevent processing (business rule violations).<br>        body:<br>          application/json:<br>            type: StandardErrorResponse<br>            example:<br>              error:<br>                code: &quot;BUS_001&quot;<br>                category: &quot;BUSINESS&quot;<br>                message: &quot;Business rule violation&quot;<br>                details: &quot;Customer already exists with this email address&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer&quot;<br>                method: &quot;POST&quot;<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;<br><br>      500:<br>        description: |<br>          Internal Server Error - A generic error occurred on the server.<br>        body:<br>          application/json:<br>            type: StandardErrorResponse<br>            example:<br>              error:<br>                code: &quot;GEN_001&quot;<br>                category: &quot;GENERAL&quot;<br>                message: &quot;Internal server error&quot;<br>                details: &quot;An unexpected error occurred while processing the request&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer&quot;<br>                method: &quot;POST&quot;<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;<br><br>      502:<br>        description: |<br>          Bad Gateway - The server received an invalid response from an upstream server <br>          while trying to fulfill the request.<br>        body:<br>          application/json:<br>            type: StandardErrorResponse<br>            example:<br>              error:<br>                code: &quot;TECH_001&quot;<br>                category: &quot;TECHNICAL&quot;<br>                message: &quot;Upstream service unavailable&quot;<br>                details: &quot;Cannot connect to the backend service&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer&quot;<br>                method: &quot;GET&quot;<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;<br><br>      503:<br>        description: |<br>          Service Unavailable - The server is currently unable to handle the request <br>          due to temporary overloading or maintenance.<br>        body:<br>          application/json:<br>            type: StandardErrorResponse<br>            example:<br>              error:<br>                code: &quot;TECH_002&quot;<br>                category: &quot;TECHNICAL&quot;<br>                message: &quot;Service temporarily unavailable&quot;<br>                details: &quot;The service is currently undergoing maintenance&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer&quot;<br>                method: &quot;POST&quot;<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;<br><br>  # Business Logic Error Handling<br>  businessErrorHandling:<br>    displayName: Business Error Handling<br>    description: |<br>      Specialized error handling for business logic violations.<br>      Use this trait for endpoints that perform business validations.<br>    responses:<br>      422:<br>        description: |<br>          Business Rule Violation - The request violates business rules or constraints.<br>        body:<br>          application/json:<br>            type: StandardErrorResponse<br>            example:<br>              error:<br>                code: &quot;BUS_001&quot;<br>                category: &quot;BUSINESS&quot;<br>                message: &quot;Business rule violation&quot;<br>                details: &quot;Customer cannot be created due to business constraints&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer&quot;<br>                method: &quot;POST&quot;<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;<br><br>  # Technical Error Handling<br>  technicalErrorHandling:<br>    displayName: Technical Error Handling<br>    description: |<br>      Specialized error handling for technical/infrastructure issues.<br>      Use this trait for endpoints that interact with external systems.<br>    responses:<br>      502:<br>        description: |<br>          External Service Error - Problem communicating with external systems.<br>        body:<br>          application/json:<br>            type: StandardErrorResponse<br>            example:<br>              error:<br>                code: &quot;TECH_001&quot;<br>                category: &quot;TECHNICAL&quot;<br>                message: &quot;External service error&quot;<br>                details: &quot;Unable to connect to Salesforce service&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer&quot;<br>                method: &quot;POST&quot;<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;<br>      <br>      504:<br>        description: |<br>          Gateway Timeout - Timeout while waiting for response from external system.<br>        body:<br>          application/json:<br>            type: StandardErrorResponse<br>            example:<br>              error:<br>                code: &quot;TECH_003&quot;<br>                category: &quot;TECHNICAL&quot;<br>                message: &quot;Gateway timeout&quot;<br>                details: &quot;Timeout while waiting for response from external service&quot;<br>                timestamp: &quot;2024-01-15T10:30:00Z&quot;<br>                correlationId: &quot;550e8400-e29b-41d4-a716-446655440000&quot;<br>                path: &quot;/api/v1/customer&quot;<br>                method: &quot;GET&quot;<br>              meta:<br>                apiName: &quot;customer-papi&quot;<br>                apiVersion: &quot;1.0.0&quot;<br>                environment: &quot;prod&quot;</pre><h3>Components Included :</h3><h4>1. StandardErrorResponse Type</h4><ul><li>Consistent error structure with hierarchical error codes</li><li>Includes correlation tracking and environment metadata</li><li>Provides request context (path, method, timestamp)</li></ul><h4>2. ValidationErrorResponse Type</h4><ul><li>Extends StandardErrorResponse for validation scenarios</li><li>Field-level error details with violation reporting</li><li>Shows rejected values for better debugging</li></ul><h4>3. Error Handling Traits</h4><ul><li><strong>standardErrorHandling</strong>: Core error responses for all APIs</li><li><strong>businessErrorHandling</strong>: Domain-specific business rule violations</li><li><strong>technicalErrorHandling</strong>: Infrastructure and external service errors</li></ul><h4>4. Complete HTTP Status Code Coverage</h4><p>Comprehensive coverage of all relevant HTTP status codes:</p><ul><li><strong>400</strong> — Bad Request (validation errors)</li><li><strong>401</strong> — Unauthorized (authentication required)</li><li><strong>403</strong> — Forbidden (insufficient privileges)</li><li><strong>404</strong> — Not Found (resource doesn’t exist)</li><li><strong>405</strong> — Method Not Allowed (HTTP method not supported)</li><li><strong>406</strong> — Not Acceptable (content type not supported)</li><li><strong>415</strong> — Unsupported Media Type (request format not supported)</li><li><strong>422</strong> — Unprocessable Entity (business rule violations)</li><li><strong>500</strong> — Internal Server Error (general server errors)</li><li><strong>502</strong> — Bad Gateway (external service errors)</li><li><strong>503</strong> — Service Unavailable (temporary unavailability)</li></ul><h3>Key Improvements Provided</h3><h4>1. Hierarchical Error Classification</h4><p>Systematic error code structure for easy categorization:</p><ul><li><strong>VAL_001</strong> — Validation errors (400 HTTP status)</li><li><strong>BUS_001</strong> — Business rule violations (422 HTTP status)</li><li><strong>TECH_001</strong> — Technical/infrastructure issues (502 HTTP status)</li><li><strong>SYS_001</strong> — System/framework errors (varies by context)</li><li><strong>GEN_001</strong> — General unexpected errors (500 HTTP status)</li></ul><h4>2. Consistent Error Structure</h4><p>Standardized JSON response format ensuring:</p><ul><li>Error informations across all APIs</li><li>Rich metadata for debugging and monitoring</li><li>Request traceability through correlation IDs</li></ul><h4>3. Enhanced Correlation Tracking</h4><ul><li>Proper correlation ID handling throughout error flows</li><li>Timestamp tracking for performance analysis</li><li>Node identification for distributed environments</li></ul><h4>4. Intelligent Logging</h4><ul><li>Structured logging with appropriate log levels</li><li>Performance metrics integration</li><li>Contextual error information</li></ul><h4>5. Reusable Components</h4><ul><li>Drop-in sub-flows that eliminate code duplication</li><li>Standardized CloudHub notifications</li><li>Audit logging integration</li></ul><h3>Implementation Benefits</h3><h4>Operational Excellence</h4><ul><li><strong>Consistent API</strong> error responses across all applications</li><li><strong>Enhanced monitoring</strong> and debugging capabilities</li><li><strong>Simplified maintenance</strong> through centralized error handling</li><li><strong>Improved customer experience</strong> with clear, consistent error messages</li></ul><h4>Development Productivity</h4><ul><li><strong>Contract-first</strong> error handling defined in RAML specifications</li><li><strong>Predictable error formats</strong> for API consumers</li></ul><h4>Enterprise Readiness</h4><ul><li><strong>Correlation tracking</strong> across distributed systems</li><li><strong>Environment-aware</strong> error responses</li><li><strong>CloudHub integration</strong> for notifications and alerts</li><li><strong>Audit trail</strong> support for compliance requirements</li></ul><h4>Production Readiness</h4><p><strong>The RAML fragments</strong> ensure API specification consistency, while the XML components will provide the runtime error handling implementation</p><h3>Usage Instructions</h3><h4>For RAML API Specifications:</h4><pre>uses:<br>  ErrorLibrary: error-handling-library.raml</pre><pre>/customers:<br>  is: [ErrorLibrary.standardErrorHandling]<br>  post:<br>    responses:<br>      422:<br>        body:<br>          application/json:<br>            type: ErrorLibrary.ValidationErrorResponse</pre><h4>For MuleSoft Applications:</h4><pre>&lt;!-- Add dependency to pom.xml --&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;com.company.shared&lt;/groupId&gt;<br>  &lt;artifactId&gt;error-handling-library&lt;/artifactId&gt;<br>  &lt;version&gt;1.0.0&lt;/version&gt;<br>  &lt;classifier&gt;mule-plugin&lt;/classifier&gt;<br>&lt;/dependency&gt;</pre><pre>&lt;!-- Use in error handlers --&gt;<br>&lt;error-handler&gt;<br>  &lt;on-error-propagate type=&quot;VALIDATION:INVALID_EMAIL&quot;&gt;<br>    &lt;flow-ref name=&quot;handle-error-complete&quot;/&gt;<br>  &lt;/on-error-propagate&gt;<br>&lt;/error-handler&gt;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a92cd1f5770" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>