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

pm.request.url.query.get(<Parameter name>)

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.

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