How can I make some element of the URL (in HTTP task) dynamic?


I’m calling a rest API with this URL in which notes will be created against a particular order and orderId can change depending on the order selection and thus it has to be dynamic.**{$orderId}**/notes

I’m storing it in a variable in a script task prior to the HTTP task call, how can I ensure that the orderId that I’m storing in the script task is being populated in the URL.

I tried doing it the way shown above but it didn’t help.



This is the way I deal with those kind of URLs.

Prior to the HTTP task, have a Script task (like you do already). However, do something like this:

final String orderId = execution.getVariable("orderId").toString();
final String url = "";
final String result = url.replace("@id@", orderId);
execution.setVariable("myUrl", result);

Then, in the HTTP task, for “Request URL”, you simply put: ${myUrl}

1 Like

Thanks @fiki574
It was helpful and it worked