I am looking to pass list of query params and path params to http request mule connector. The input which is coming to this connector is a List of pojo which contains the value of query and path params.
The http request connector looks something like below:
<http:request config-ref="HTTP_Request_Configuration" path="/rates/api/v1/rates/{in}.csv" method="GET" doc:name="End_HTTP request">
<http:request-builder>
<http:query-param paramName="api_key"
value="abcde" />
<http:query-param paramName="quote" value={target_currency} />
<http:query-param paramName="date" value={date} />
<http:query-param paramName="fields" value="averages" />
<http:uri-param paramName="in" value={source_currency} />
</http:request-builder>
The pojo class looks like this:
public class Data {
private String sourceCurrency;
private String targetCurrency;
private String date = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date());
public Data() {
}
public String getSourceCurrency() {
return sourceCurrency;
}
public void setSourceCurrency(String sourceCurrency) {
this.sourceCurrency = sourceCurrency;
}
public String getTargetCurrency() {
return targetCurrency;
}
public void setTargetCurrency(String targetCurrency) {
this.targetCurrency = targetCurrency;
}
public String getDate() {
return date;
}
}
If the input to http request connector is the object of Data class then how to set the query and path params.
Can someone please help me with an example?
Thank you.
Sumved