MULESOFT-DEVELOPER-I practice question 17 of 30

What should this endpoint return? http://dev.acme.com/api/patients?name=John&surname=Bell

Full set: 235 questions
Answer options
A: Patient with name as John
B: Patient with surname as bell
C: Patients with either name as John or surname as Bell
D: Patients with name as John and surname as Bell Correct answer
Correct Answer:
D. Patients with name as John and surname as Bell
Explanation

The URL http://dev.acme.com/api/patients?name=John&surname=Bell is making a GET request to the /api/patients endpoint with two query parameters: name=John and surname=Bell. In standard REST API conventions, multiple query parameters separated by an ampersand (&) are treated as a conjunctive filter, meaning an "AND" condition. The API should interpret this request as a search for patients where the name attribute is "John" AND the surname attribute is "Bell".

Why Incorrect

A. This is incorrect as it only considers the name parameter and ignores the surname parameter provided in the request.
B. This is incorrect as it only considers the surname parameter and ignores the name parameter.
C. This implies a disjunctive ("OR") condition. The & separator in a URL query string universally signifies an "AND" condition for filtering resources.

References

1. MuleSoft Documentation, "HTTP Listener Connector". In the "Accessing Query Parameters" section, it shows that query parameters are available in the attributes.queryParams object. A Mule flow would typically use these multiple parameters to build a combined filter (e.g., in a database WHERE clause like WHERE name = :name AND surname = :surname).

2. IETF, "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax", Section 3.4. The standard defines the query component of a URI, where & is a common, though not formally standardized, delimiter for key-value pairs that represent a set of conditions. The conventional implementation in web frameworks and APIs is to treat them as AND conditions.

Scroll to Top