Designing APIs8% of the exam
Query parameters versus URI parameters
When a value belongs in the path as a URI parameter, in the query string as a query parameter, or in a header, how RAML 1.0 declares `uriParameters` and `queryParameters`, which mistakes API Designer flags, and how APIkit strict validation treats undeclared query parameters.
Identify when and how to define query parameters vs URI parameters.
~7 min read · 6 practice questions ·
What the exam expects
- Decide whether a value is a URI parameter (it identifies one resource), a query parameter (an optional filter on a list) or a header (credentials such as
client_idandclient_secret). - Declare
uriParameterson the resource andqueryParametersunder the method in RAML 1.0, withtype,requiredandexample. - Match a request URL to a specification, and spot what API Designer flags: unused URI parameters and URI parameter values containing
/. - Reject undeclared query parameters at runtime with APIkit's Query Parameters Strict Validations.
- Key terms: URI parameter (a
{name}placeholder in a resource path, filled with a value); query parameter (a name/value pair after?);uriParameters(RAML node on a resource that describes its placeholders);queryParameters(RAML node on a method that describes its query string); strict validation (APIkit setting that accepts only declared query parameters or headers).
Key facts
Identifier
- Detail
- URI parameter in the path, as in
/flights/{ID}(required string)
Optional filter
- Detail
- Query parameter, as in
destinationonGET /flights
Client credentials
- Detail
- Headers by default and recommended; query parameters pose security risks
uriParameters- Detail
- Declared on the resource whose path holds
{name}
queryParameters- Detail
- Declared under the method, with
type,required,example
Unused declared URI parameter
- Detail
- Warning: unused uri parameter
/ in a URI parameter value- Detail
- Error: must not contain '/' character
Reject undeclared query parameters
- Detail
queryParamsStrictValidation="true"onapikit:config
disableValidations="true"- Detail
- Turns off query parameter and header validation to minimize latency
Sources for this section (5)
- Master API Calls with REST Clients and MuleSofttrailhead.salesforce.com (opens in a new tab)
- Client ID Enforcement Policydocs.mulesoft.com (opens in a new tab)
- Common Problems Found in RAML 1.0 API Specificationsdocs.mulesoft.com (opens in a new tab)
- Building, Implementing, and Testing a REST APIdocs.mulesoft.com (opens in a new tab)
- Validating Query Parameters and Headersdocs.mulesoft.com (opens in a new tab)
- Why does the API Console's default Mocking Service return a success response even when
client_secretis missing? - Which RAML node declares the
idquery parameter in the APIkit tutorial, and is it required? - Why does an APIkit Router that validates query parameters still not reject a call with a missing credential?
- When the mocking service Try it form takes query parameters, in what form do you enter them?
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 (6 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams