Referencing environment variable from collection variable

I have a collection per service and environments for Dev and Prod

At the environment level I would like to set variable like this:

apiBaseUrl = https://api-dev.example.com

and then in the collection service1 I would like variable like so:

baseUrl = {{apiBaseUrl}}/service1

Unortunately when I reference {{baseUrl}} in a query inside service1 it’s value is expanded to {{apiBaseUrl}}/service1.

Is Postman incapable of recursive variable expansion?

Hey @mwisnicki :wave:

Welcome to the Postman Community! :postman:

Are you able to share an image of how that looks in your Postman instance, please?

To resolve the variable value you would need to use the .replaceIn('{{var_name}}') function. As everything that’s stored in the environment file is a string, without resolving it correctly, you’re just going to get that string value back.