We have already seen usage of Query params in API. We may need to retrieve query parameters value in Tests and Pre-request Script for validation. So in this post, we will see how can we retrieve query parameters value.
To get value of specific query parameter:-
To get all query parameter as a list:-
To get query string of URI:-
Let’s see above concept in an example:-
Let’s add params to API:-
Add script to Tests:-
Hit and see Postman Console:-
Import above example from below collection:-
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.