RAML 1.0 Fundamentals
RAML (RESTful API Modeling Language) is a YAML-based language for describing REST APIs clearly and concisely.
A RAML file begins with the version header `#%RAML 1.0` and a set of root-level properties: title, version, baseUri, and mediaType. Resources are declared with a `/path` key, and HTTP methods are nested under them.
RAML supports data types, traits (reusable method behaviour like pagination), resource types (reusable resource patterns), and libraries. These features eliminate repetition and make large API specs maintainable.
MuleSoft's API Designer in Design Center provides a live preview and mock server from your RAML spec — no code required.
#%RAML 1.0
title: Orders API
version: v1
baseUri: https://api.acme.com/{version}
mediaType: application/json
types:
Order:
type: object
properties:
orderId: string
customer: string
amount: number
status: string
/orders:
get:
description: Retrieve all orders
queryParameters:
status:
type: string
required: false
responses:
200:
body:
application/json:
type: Order[]
post:
description: Create a new order
body:
application/json:
type: Order
responses:
201:
description: Order created