I have to perform a GET Request a Microsoft Dynamics 365 CRM URL. The request has one query parameter called select and the value of the query param is as below
consultingid,expert,scientist,host_value,numberofdaysspentconsultingannualsurvey,dateofsurvey&$expand=scientist($select=employeeid)
I am using the encodeURI function in Dataweave as below as the value has & $ etc
<http:request method="GET" config-ref="Dynamics365_CRM_Request_Configuration" path="${dynamics365.crm.http.path}" doc:name="Request" doc:id="903e22c5-47c0-47bd-9faa-c87d217bf856" >
<http:headers ><![CDATA[#[import * from dw::core::URL
output application/java
---
{
"Authorization" : "Bearer " ++ vars.bearerToken,
"Prefer": "odata.maxpagesize=250, odata.include-annotations=OData.Community.Display.V1.FormattedValue",
"Content-Type" : "application/json"
}]]]></http:headers>
<http:query-params ><![CDATA[#[import * from dw::core::URL
output application/java
---
{
"\$select" : encodeURI(vars.dynamicsUrl)
}]]]></http:query-params>
</http:request>
When I submit I am getting a response saying Syntax error: character '&' is not valid I see that the & is correctly encoded with %26 as below fragment
%2Cdateofsurvey%26%24expand%3Dsage_scientist%28%24select%3Demployeeid%29
Any help would be greatly appreciated.