MULESOFT-DEVELOPER-I practice question 28 of 30

How are query parameters dynamically passed to an outbound REST request using an HTTP Request operation?

Full set: 235 questions
Answer options
A: As query parameters in the HTTP Request operation Correct answer
B: As URI parameters in the HTTP Request operation
C: In the Mule event's payload
D: As flow variables
Correct Answer:
A. As query parameters in the HTTP Request operation
Explanation

The HTTP Request operation in Mule 4 provides a specific configuration section named "Query Parameters" to build the query string of an outbound URL. To pass values dynamically, you define key-value pairs in this section, where the value for each key is a DataWeave expression. These expressions can dynamically access data from the Mule event, such as variables (vars), the payload (payload), or attributes (attributes). This is the direct and intended method for dynamically constructing query parameters like ?status=active&region=emea for an outbound REST request.

Why Incorrect

B. URI parameters are placeholders within the URL path (e.g., /orders/{orderId}), which is distinct from query parameters.
C. The Mule event's payload is typically mapped to the HTTP request body, not used to define URL query parameters.
D. While flow variables can be the source of the data, they must be referenced via expressions within the "Query Parameters" section.

References

1. MuleSoft Documentation, "HTTP Connector 1.7 Reference", Request Operation. The configuration details list "Query Parameters" as a field that accepts a "Map of key-value pairs for the query string of the request."

2. MuleSoft Documentation, "Studio Visual Editor", HTTP Request Connector. The UI screenshots and descriptions clearly show the "Query Parameters" tab for adding key-value pairs, which can be set to literal or expression mode (fx).

Scroll to Top