I am sending array list of Query params through HTTP request
Array list id's [1234,3442,9489,9498]
<http:request method="GET" config-ref="HTTP_Request_configuration"
path="${p.path}">
<http:query-params><![CDATA[#[output application/java
--- {"id" : payload }]]]>
</http:query-params>
I am getting following error:
Error: java.util.ArrayList cannot be cast to > java.lang.String
Note: if i send them through for each, its working as expected. But i would like to pass them as list through query string params using IN operator in database
select Query:
<flow name="query database" >
<set-variable value="#[attributes.queryParams.'id']" doc:name="ID" variableName="ID"/>
<db:select doc:name="Get data" config-ref="Db Connection">
<db:sql >
SELECT * from Mytable where id in ( :Ref) </db:sql>
<db:input-parameters ><![CDATA[#[{
Ref: vars.ID
}]]]></db:input-parameters>
</db:select>
Workaround: Array list is converted to 1234,3442,9489,9498 using dataweave function reduce($+$$), yet returning error
Any ideas on how to pass array list with coma seperated values through query params and using them in IN clause of DB query
Edit: (payload joinBy ", ") as String helped me pass these values as string, Also changed type in RAML.
Now, how can i pass these values to DB to IN clause