I have an API endpoint that I can send GET request to using in Anypoint Request component. It has start_date and end_date as query parameter.
I also have a Listener component that is serving the API using the same query parameters.
When I hardcode the values to the query parameters of my Request component but I want it to use the values from the Listener component.
When I try to parameterize it using #[attributes.queryParams in the path of the listener, I get a error saying that # is a bad character.
What can I do to have the Listener query parameters utilize the query parameters of the Response component.
Here's the XML:
<flow name="SystemSleepData" doc:id="59534418-29cb-4830-a5fb-15ac34c6f02d" >
<http:listener doc:name="Listener" doc:id="d47d3e45-05cb-44f8-899b-d6c34fbb2a65" config-ref="HTTP_Listener_config" path="/system_sleep_data" allowedMethods="GET"/>
<http:request method="GET" doc:name="Oura Sleep Info" doc:id="04e89eeb-0125-4d0c-8272-9bc07a47e500" config-ref="HTTP_Request_configuration" path='/v2/usercollection/sleep?start_date="#[attributes.queryParams.start_date]"&end_date="#[attributes.queryParams.end_date]"' >
<http:headers ><![CDATA[#[output application/java ---{"Authorization" : "Bearer HIDDEN"}]]]>
</http:headers>
</http:request>
</flow>
Here's a picture of the components:

Query parameters received by the HTTP Listener are in attribute
attributes.queryParamswhich is an object and its keys are the query parameter names. For example for the requesthttp://localhost:8081/query?start=123&end=456you can use the DataWeave expression#[attributes.queryParams.end]to get the value456.More details on the HTTP Listener documentation.
In the HTTP Requester you can add query parameters by using an expression to create an object, again the keys are the parameter name and the values the query parameter value. You can reference the values from the attributes or any valid DataWeave expression. Don't put the query parameters in the URL because that doesn't allow the connector to know those are parameters and doesn't use the HTTP Connector features for query parameters.
Example:
See the Requester documentation for more details.
Note that if you use another connector between the HTTP Listener and the HTTP Requester you may need to save the value of the attributes to a variable to preserve them of being overwritten.