Designing APIs8% of the exam

RAML responses, examples and the mocking service

How RAML 1.0 nests responses, bodies and media types, how types and examples (inline, .yaml files and NamedExample fragments) must match, and which response the API Designer mocking service returns with and without behavioral headers.

Official exam objective
Define REST API parameters and responses.

~8 min read · 9 practice questions ·

What the exam expects

  • Declare a method's response in RAML 1.0 with the right nesting: responses, status code, body, media type, then type or example.
  • Fix "Payload media type is mandatory" with a local media type key or a root mediaType.
  • Write types and examples that validate: required versus optional (?) properties, additionalProperties, strict YAML typing in enum, and examples kept in external files.
  • Predict which status code and example the mocking service returns, and pick the behavioral header that changes it; know who can call the mock and when.
  • Key terms: media type (the key such as application/json that a payload is declared under); mediaType (root node that sets the default media type); NamedExample (a RAML fragment whose keys name each example); mocking service (an Anypoint Platform feature that answers calls with the specification's responses); behavioral header (an MS2-* request header that changes the mock's behavior).

Key facts

Response nesting
Detail
responses: then status code then body: then media type then type
Missing media type
Detail
"Payload media type is mandatory"; fix locally or with root mediaType
Optional property
Detail
Trailing ?, as in age?: integer
Several external examples
Detail
Always the examples facet
NamedExample fragment
Detail
A key names each example; values are not at the root
Mock default
Detail
Lowest status code defined for the method
MS2-Status-Code
Detail
Filters the defined status codes
Public mock URL
Detail
No authorization header; re-enabling generates a different URL
Sources for this section (4)
  • Why must MS2-Status-Code list two codes when it is combined with MS2-Error-Rate?
  • When no MS2-Error-Level is sent, which error ranges may the mock use?
  • What is the maximum value MS2-Delay accepts?
  • How can the lifetime of a mocking service public URL be limited?

The questions are free to read. Answers with their sources and self-grading are included with the pack.

Keep reading with the MuleSoft Developer pack

  • Core concepts
  • Exam traps
  • Worked scenario

The pack includes:

  • All 40 lessons of the MuleSoft Developer guide, with reading progress
  • Interactive decision walks and step-by-step sequence steppers
  • Practice exams purchase adds inline bank questions and topic practice (9 questions for this lesson)
  • An official source cited for every claim
  • An AI tutor that answers from the guide
  • Unlimited timed practice exams

Practice for the MuleSoft Developer exam