REST call using http-connector with dynamic URL constructed using environment variables

Hello,
I’m trying to setup a task on Camunda that would make a REST call using http-connector.
I’m using Spring Boot 3.1.4, JDK 17, Camunda bpm 7.20.0.

URL construct is: http://:/endpoint?param1=xxx&param2=yyy

The values xxx and yyy would be derived from process variables. While I want to configure the entire URL in a spring boot yml file
Eg in my yml file:
bookByAuthorPublisherUrl: http://10.12.252.123:4567/book?author=##author##&publisher=##publisher##

I’m using an http-connector and I’m able to load the placeholder using ${environment.getProperty(‘bookByAuthorPublisherUrl’)}. After this is where I’m stuck.
How do I go about replacing the placeholders with the actual author and publisher values from process variables?

Is this possible using http-connector at all? Or should I switch to a Groovy script/Java task?

Hi @amrut,

you can compose expressions just writing one after another: Jakarta Expression Language.

For example, you can write ${url}?author=${author}&publisher=${publisher}

Hope this helps, Ingo

Hi @Ingo_Richtsmeier,
Yes, this is possible. But I wish to load the URL with placeholders from a yml configuration. In that case, is it possible to write the expression with replace() method?

If not and I have to use a script, how do I access spring boot yml configuration on inline Javascript?

Hi @amrut,

I haven’t used these mix of configuration with yaml and JavaScript. It could be possible.

If the expressions ${environment.getProperty(‘bookByAuthorPublisherUrl’)} get evaluated correctly, you could use input mappings to store these values in local variables and use the variables (with another expression) to compose your URL string.

Hope this helps, Ingo

Hi @Ingo_Richtsmeier ,
Yes. That is my last resort where I’m forced to duplicate the spring boot configurations onto Camunda process variable. Was just checking if there is a way around it.

I’ve seen one post where @Niall suggested to move the entire logic onto a Java Delegate. I might just do that as an alternative.

Appreciate your responses! Cheers.