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:-
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>”.
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.