MCPA-LEVEL-1 practice question 7 of 15

How can the application of a rate limiting API policy be accurately reflected in the RAML definition of an API?

Full set: 95 questions
Answer options
A: By refining the resource definitions by adding a description of the rate limiting policy behavior
B: By refining the request definitions by adding a remaining Requests query parameter with description, type, and example
C: By refining the response definitions by adding the out-of-the-box Anypoint Platform rate-limit- enforcement securityScheme with description, type, and example
D: By refining the response definitions by adding the x-ratelimit-* response headers with description, type, and example Correct answer
Correct Answer:
D. By refining the response definitions by adding the x-ratelimit-* response headers with description, type, and example
Explanation

Applying a rate limiting policy introduces a specific behavior to the API: it returns HTTP headers to inform the client about its current request quota. The most accurate way to reflect this in the API's contract (the RAML definition) is by explicitly defining these response headers. Standard headers for this purpose include X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset. By adding these headers to the response definitions in RAML, the API specification becomes a precise, machine-readable contract that allows client developers to build applications that can gracefully handle the rate limits imposed by the policy.

Why Incorrect

A. A description is human-readable documentation but is not part of the machine-readable contract that defines the API's functional behavior.
B. Rate limiting information is communicated from the server to the client in the response, not sent by the client in a request query parameter.
C. The securitySchemes section in RAML is specifically for defining authentication and authorization mechanisms (like OAuth 2.0), not for quality-of-service policies like rate limiting.

References

1. MuleSoft Documentation, "Rate Limiting and Rate Limiting-SLA Based Policies": This official documentation details the behavior of the rate limiting policy. It explicitly states, "When you select the Expose Headers option, the following headers are returned in the response to a client application: x-ratelimit-remaining, x-ratelimit-limit, and x-ratelimit-reset." This confirms that the policy's behavior is manifested through response headers.

Source: MuleSoft Docs > API Manager > Policies > Rate Limiting and Rate Limiting-SLA Based Policies > Response Headers section.

2. RAML 1.0 Specification, "Headers": The official RAML specification, used by MuleSoft, defines how to declare headers within a request or response. It states, "The headers property specifies the HTTP headers that can be sent as part of a request or response." This provides the mechanism within the specification to accurately model the headers mentioned in the MuleSoft policy documentation.

Source: RAML 1.0 Specification (raml.org) > Language Guide > Requests and Responses > Headers section.

Scroll to Top