What is the best way to store a variable in a URL?

Hello everyone!

I would like to know what is the best way to store a variable in a URL. Here in my team we have countless APIs that includes an ID on its path.
For example: https://dev.environment.com/entity/{{entityId}}

It is very troublesome to leave that variable directly on the URL because Postman understand as it is a change on the URL itself, and keep asking to save changes that does not need to be considered.

The best case scenario would be the possibility to use something close to Params to speed up the editing of that field:

But, of course, it only works for GET requests (that actually receive params).

What options do I have? Save on an Environment? On the Collection Variables? I saw that it is also possible to use Pre-request Scripts to add the variable before sending the request, but it does not get so visible.

Hey @lavinia !

I’m not sure I fully understand what you’re trying to do, but would Path Variables be an option here? You can use :entityId in your URL for it to appear in the params tab, e.g.:

4 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.