Advantage of path variables over environment or global variables?

Hi all. Is there any advantage in using path variables over using environment or global variables in my request URLs? For example, is there any advantage in using

https://example.com/:foo/bar

where :foo has value {{wombat}}, over using

https://example.com/{{wombat}}/bar

Thanks in advance.

Hi Markus

I am curious why you would be using a path variable :foo with a value which is again a variable {{wormbat}}.
It just adds more complexity. Also, there have known issues with using path variables because of lack of a standard delimiter.
Some users expect https://example.com/:path.html to resolve in https://example.com/user.html when :path be user and some would expect this to work only when :path.html to be user
To avoid this complexity and confusion, I would recommend using environment, globals or collection variables.
For e.g. this syntax https://example.com/{{path}}.html would have no confusion at all. It’s very clear what is expected to be replaced.

Let me know if you have a different use case where path variables are more helpful.

1 Like

Thank you for your reply. I just got started using Postman and exploring its capabilities. I found path variables in the documentation and started using them. But I agree with you that non-path variables can easily replace path variables. Another problem with path variables is that they are not high-lighted in the URL input field. So they are easily overlooked. So far I found no use case were path variables are more useful.

Thanks again for sharing your thoughts.