RAML and Publish to Exchange in MuleSoft

Join us to learn about Basic of RAML and how to publish API to exchange in MuleSoft. We will learn about resourceTypes, Using ! include, types and type in RAML.

When & How to use resourcesTypes?

  • “resourceTypes” refers to a way to define reusable templates or blueprints for different types of resources in your API.
  • Think of them like a set of instructions that you can use to create consistent and standardised resource definitions.
  • Used for Best practices to avoid writing code again and again.
  • The resourceTypes uses some user-defined parameters surrounded by double angle brackets (<< and >>)
  • <resourcePath> – represents the entire URI (not URL)
  • <resourcePathName> – represents the part of URI (the oath of the URI following the right most forward slash)
  • Parameter functions for example:
  • For example, given the resource /health, where <> evaluates to “health”
    <resourcePathName | !uppercase> ==> “HEALTH”


YouTube video

When & How to use traits?

  • “traits” are a kind of resourceTypes
  • Understand this way : resourceTypes are used to extract pattern from “resource” definitions (resource level) , whereas , traits are used to extract patterns from “method” definitions that are common across resources.
  • In simpler terms, traits are defined to use whenever there is a common functionality needs to be implemented across more than one method at-least.


  • First, we need to identify the redundant(repeated) sections of our resources, recognize their patterns, and extract resource types.
  • Then should do the same for the methods that are common across resources to extract traits. Then we will be able to eliminate further redundancies by applying traits to our resource types .
  • To summarize, we use resourceTypes and traits to eliminate writing the same code repeatedly . Instead, Write once and use it across


Checkout our complete MuleSoft Training to learn all about MuleSoft. We have 15+ session for you with Final Project.

Amit Chaudhary
Amit Chaudhary

Amit Chaudhary is Salesforce Application & System Architect and working on Salesforce Platform since 2010. He is Salesforce MVP since 2017 and have 17 Salesforce Certificates.

He is a active blogger and founder of Apex Hours.

Articles: 460

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *