# How to set dynamic URL parameters in a call template?

**URL:** <https://community.novulo.com/t/how-to-set-dynamic-url-parameters-in-a-call-template/207>\
**Category:** Wiki\
**Tags:** rest\
**Created:** [May 30, 2024, 1:53pm UTC](https://community.novulo.com/t/how-to-set-dynamic-url-parameters-in-a-call-template/207 "2024-05-30T13:53:14Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![j.batzke](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.novulo.com/j.batzke/32/9_2.png) [@j.batzke](https://community.novulo.com/u/j.batzke)\
**Post date:** [May 30, 2024, 2:31pm UTC](https://community.novulo.com/t/how-to-set-dynamic-url-parameters-in-a-call-template/207/2 "2024-05-30T14:31:51Z")

</div>

Hey Remy,

that’s possible with the current versions of M10074 and M7899  
In general, calls are being executed by using the process ‘N\_Call Template Build, Execute, Process’. This process has a parameter called ‘parameters’ of type ‘List\<Tuple\<String,Mixed\>\>’.  
For calls like POST, PUT etc. this parameter is used to [build a body.](https://community.novulo.com/t/call-templates-using-call-parameters-in-a-call-template-export/165/2). For GET calls, this list can be used to build up a dynamic URL.  
See the steps below for an example:

### Using query parameters in GET calls

1. Create a call template for a GET call. As an example, I use the free weather API from [open-meteo.com](http://open-meteo.com) by calling [https://api.open-meteo.com/v1/forecast](https://api.open-meteo.com/v1/forecast)  

2. I want to get the temperature for Hamburg, so I have to pass the following query parameters:

- latitude = 53.5507
- longitude = 9.993
- hourly = temperature\_2m

1. To pass these to the process, I first have to rewrite the key-value pairs in the format of a ‘List\<Tuple\<String,Mixed\>\>’. The format looks like this “[\<“key1”,“value1”\>,\<“key2”,“value2”\> ..]”, so in our example we get:

> [\<“latitude”, “53.5507”\>, \<“longitude”, “9.993”\>, \<“hourly”, “temperature\_2m”\>]

1. Then, I execute a test call with the test panel:  
 ![image](https://canada1.discourse-cdn.com/flex008/uploads/novulo/original/1X/1aec9ede5876c2da5668ffec313006974ccc2dcd.png)
2. The call is executed successfully and contains the correct query parameters:  
 ![image](https://canada1.discourse-cdn.com/flex008/uploads/novulo/original/1X/e095baf39cb5a11c24142a0a448cda5b4a9dbc21.png)
3. For your custom use case, make sure to pass the list of tuples to the process “N\_Call Template Build, Execute, Process”. You can do so for example by configuring a [scheduled task](https://community.novulo.com/t/how-to-add-a-new-scheduled-task-geplande-taak/196). Here, you can define an expression for the “parameters” list, which dynamically determines the correct parameters per execution.

### Using path variables in GET calls

Maybe the steps above are not enough to complete your goal. As you can see, the base URL “[https://api.open-meteo.com/v1/forecast](https://api.open-meteo.com/v1/forecast)” is static and remains unaffected. But what if we also want to call “[https://api.open-meteo.com/v1/dwd-icon](https://api.open-meteo.com/v1/dwd-icon)” for weather data from the German weather service (DWD) with the same call template?

We can extend the base URL of a call template by using a “path variable”.

1. Create a call template and set the fixed base URL that won’t change. In our example, that is “[https://api.open-meteo.com/v1](https://api.open-meteo.com/v1)”.
2. Then we define a parameter list, like above, but with a new special item:

> [\<“latitude”, “53.5507”\>, \<“longitude”, “9.993”\>, \<“hourly”, “temperature\_2m”\>, **\<“n\_pathvariable”, “forecast”\>**]

1. The key “n\_pathvariable” is a special hard-coded key. Its value is evaluated and then added to the base URL with a “/”. So, when I execute a test call, I get the same result as in the previous example.
2. To toggle between “forecast” and “dwd-icon” one simply has to change the value of the “n\_pathvariable” item to “dwd-icon”

> [\<“latitude”, “53.5507”\>, \<“longitude”, “9.993”\>, \<“hourly”, “temperature\_2m”\>, **\<“n\_pathvariable”, “dwd-icon”\>**].

1. The resulting call looks like this:  
 ![image](https://canada1.discourse-cdn.com/flex008/uploads/novulo/original/1X/17e79439cea7b8cd85c119d59ed1ff0f51b032c8.png)

---

_[View the full topic](https://community.novulo.com/t/how-to-set-dynamic-url-parameters-in-a-call-template/207)._
