Salesforce MuleSoft Developer study materials
Salesforce MuleSoft Developer study resources

Salesforce MuleSoft Developer cheat sheet

Salesforce MuleSoft Developer · Keep the key ideas within reach.

Quick reference

Explaining and Creating API Specifications with Anypoint Platform

  • An API specification is a machine-readable contract; RAML 1.0, OpenAPI 3.0, and AsyncAPI are the formats supported in Design Center.

  • API-led connectivity uses three layers: system APIs expose systems of record, process APIs orchestrate logic, and experience APIs serve channels.

  • RAML 1.0 starts with #%RAML 1.0 and defines title, version, baseUri, resource paths, methods, and optional traits, resourceTypes, and data types.

  • OpenAPI 3.0 uses fields openapi, info, servers, paths, and components/schemas; operations are HTTP verbs under each path.

  • Traits in RAML and reusable components in OpenAPI factor common headers, query parameters, and responses out of individual methods.

  • Mocking Service generates a callable mock endpoint from a published specification so consumers can test before implementation.

  • Design Center holds specification projects; publishing to Exchange makes an asset discoverable and versioned for reuse.

  • Spec-first design validates the contract before code; code-first derives a specification from an implementation and can drift from it.

  • The API Console renders interactive documentation from the specification, including request and response examples.

Quick reference

Deploying and Managing API Implementations

  • Deployment targets include CloudHub, CloudHub 2.0, Runtime Fabric, and customer-hosted Mule runtimes.

  • An API implementation registers with API Manager through autodiscovery, which binds the deployed application to an API instance and its policies.

  • API Manager policies such as rate limiting, SLA tiers, OAuth 2.0, and JWT validation are applied at the API instance, not in flow code.

  • Runtime Manager manages applications, workers, servers, alerts, and logs across environments.

  • CloudHub application properties can override values per environment; secure properties are encrypted with the secure properties tool.

  • Maven and Anypoint CLI support CI/CD; the deployable artifact is a Mule application JAR built from the project.

  • Log4j2 configuration controls log levels and appenders; CloudHub captures application logs and metrics.

  • Worker sizing and persistent queues affect throughput and reliability; persistent queues survive application restarts.

  • Separate environments such as Design, Sandbox, and Production use distinct credentials, API instances, and property values.

Quick reference

Implementing RESTful API Logic with Mule Flows

  • APIkit Router reads a RAML or OpenAPI specification and routes requests to generated flows by resource and method, returning 404 or 405 for unmatched calls.

  • HTTP Listener receives requests; its attributes expose headers, queryParams, uriParams, and method.

  • HTTP Request sends outbound calls and supports method, URI, query parameters, headers, and response validation.

  • Choice router evaluates DataWeave expressions top-down and routes to the first true branch, with an optional default.

  • Scatter-Gather runs routes in parallel and aggregates results; an error in any route fails the aggregate by default.

  • Flow Reference invokes another flow synchronously; private flows are not directly addressable by connectors.

  • Set Payload, Set Variable, and Transform Message create or modify event data; variables live for the flow's execution.

  • DataSense uses connector and specification metadata to suggest expressions and payload structures in Studio.

  • REST status codes include 200 OK, 201 Created, 204 No Content, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, and 500 Server Error.

Quick reference

Transforming Data with DataWeave

  • DataWeave scripts start with %dw 2.0, declare input and output directives, and separate declarations from the body with ---.

  • Selectors: . accesses object keys, [n] indexes arrays, .* returns multiple matching values, and .. descends recursively.

  • map transforms arrays, mapObject transforms objects, filter selects elements, and reduce collapses an array to one value.

  • pluck converts an object into an array, groupBy partitions by key, orderBy sorts, and distinctBy removes duplicates by criteria.

  • The anonymous parameters $ and $$ refer to the current item and index in array operations.

  • The as operator coerces types, for example payload as String or payload as Array; invalid coercion raises an error.

  • format and read/write functions convert between MIME types such as JSON, XML, CSV, and Java.

  • Variables are declared with var and functions with fun; both are evaluated in the script body.

  • The default operator supplies a fallback when a value is null or absent: payload.name default 'unknown'.

Quick reference

Controlling Event Flow and Handling Errors

  • Mule error types are namespaced, for example HTTP:NOT_FOUND, VALIDATION:INVALID_BOOLEAN, APIKIT:NOT_FOUND, and DB:QUERY_EXECUTION.

  • On Error Propagate handles the error then rethrows it; On Error Continue handles it and returns the fallback as the flow result.

  • A Try scope isolates components and applies its own error handler without changing the flow's outer error handling.

  • The error object exposes error.type, error.description, error.errorMessage, error.cause, and error.childErrors.

  • Raise Error throws a custom error with a chosen type and description.

  • Until Successful retries a component with configurable maximum retries and milliseconds between attempts.

  • Scatter-Gather and Async scopes change execution semantics: parallel aggregation versus fire-and-forget.

  • The default error handler logs and rethrows; a global error handler applies to all flows in the application.

  • HTTP status mapping in error handlers commonly uses 400 for validation, 404 for not found, and 500 for internal errors.