Postman request with 'global' URL

Viewed 1976

I want to know if it's possible to add a "prefix" to all request URLs in Postman?

Normally a request looks like this:

HERE

http://localhost:8000/test

But I want to just put:

/test

And put the http://localhost:8000 like a global URL.

I ask this because I swap so much from local to server for same URL and I would like to just change one URL and not URLs for all requests all the time.

1 Answers

Have you looked at using an environment file?

https://www.getpostman.com/docs/v6/postman/environments_and_globals/manage_environments

Add a variable called url with the http://localhost:8000 value. You can then use this value in the URL like {{url}}.

If your requests are constructed like {{url}}/test - You can create as many environments as you like with the url variable different in each one. So by changing the environment this will point your requests at a local, staging or production server.

Related