Postman Tutorial Part 31 – URI Path Variables in Postman

End points or URI may not be constant always. For example:- If you want to retrieve a booking details, you need to pass booking id in URI as below:-

https://restful-booker.herokuapp.com/booking/1

https://restful-booker.herokuapp.com/booking/2

In above URI, 1 and 2 are booking ids and those are not constant. This makes above URI dynamic. You should have a way to pass desired value in URI from other source so that you no need to make any changes in URI explicitly.

You can parameterized dynamic URI using variable concepts of Postman. There is another way of handling dynamic URL as well which is called Path Parameters or URL parameters or Path variables.

A Path variable is a placeholder in URI whose value can be provided in similar way as a query param. A path parameter can be added in to URI as “:<param name>”.

For example:-

https://restful-booker.herokuapp.com/booking/:id

We can have multiple path params in a URI.

When we have a path variable in URI, Postman gives you a place to pass the value as shown below:-

Whatever value you pass for id in Path variables, it will replace in URI.

You can also use environment or global variable to pass value to path variables.

Refer basics of API Testing here.

Refer detailed tutorial of Postman here.

More about API Testing in upcoming posts. Stay tuned.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappyApiTesting

Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.
%d bloggers like this: