August 31, 2020
Estimated Post Reading Time ~

Request Parameters in Postman

What are Parameters in Request?

Request Parameters are part of the URL which is used to send additional data to the Server. Let us analyze a simple URL:

https://www.bing.com/search?q=ToolsQA

In this URL Request parameter is represented by the “q=ToolsQA” part of the URL. The request parameter starts with a question mark (?). Request parameters follow the “Key=Value” data format. In our example, “q” is the Key, and “ToolsQA” is the value. The server reads the Request parameter from the URL and sends a Response based on the Request Parameter. In our example, Bing will return search results for ToolsQA. If you change the Value from ToolsQA to DemoQA, you will get results for DemoQA instead of ToolsQA. This means that the Server reads the Request parameter and responds based on that.

In simpler words, let us say I designed a page that can show you the student list of a particular class. Now, the list will depend on the class you select, which will be passed in the URL as a parameter while the page I designed will be the same for every class. I don’t have to design many pages as many as there are classes. This way we improve efficiency and usage at both levels.

Parameters can be passed in GET Request.

Before talking about Parameters and understanding them clearly, we will send the URL in our browser.

1. Go to your browser and write www.google.com in your address bar



2. You will see the response page from Google. Type ToolsQA in the search bar and press Google Search.



Now you need to understand here that the page which shows the results will remain the same just the results will differ according to the search. You just now searched for ToolsQA, this serves as a parameter in the URL to tell the server that we need the results of the ToolsQA specifically. The server responds according to the search parameter.

A URL consists of many parameters such as source id and encoding format etc. See the URL below and you will see &q=ToolsQA which is added in the URL to tell the server.



Note: here “q” is the key represents query and ToolsQA is the value of the key or search term for the query.

Now, we will try to achieve the same results through Postman.

Request Parameters in Postman

1. Just prepare a GET Request in Postman with the URL www.google.com/search and then click on Params.



2. Write the following things written under Key-Value pair as shown. Again q stands for query here and ToolsQA is the search term. Now press Send.



3. Look at the preview, you would see that instead of the google home page we have received a response for a specific search query which is ToolsQA. Instead of ToolsQA you could write anything and receive its response. This indicates that we have passed some information (Parameters) about the result we wish to see.



NOTE: As discussed above, you can see that different search queries give different results but the page design remains the same, just the content differs.

Multiple Parameters

You can also use multiple parameters inside a single query. As we discussed above while sending the search query as ToolsQA, there are many parameters that are sent in the URL. ToolsQA was for the results that were to be shown, another parameter such as encoding format is also used to tell the server in which format can the result be encoded and sent to the client. In the above example, the default encoding format used is UTF-8.

See at the above image and focus on just the URL sent to the server



In the above URL wherever you see & it must be succeeded by a parameter such as &ie=UTF-8 means ie is a key parameter with a value UTF-8. You can write each of the parameters that you see above in the postman and send a request with multiple parameters.



These parameters are not for our users to study in detail. Even if you change the parameters, the changes reflected will not be seen on the page and you will still get the same response as before because all these parameters are for internal activities in the server such as logging the submission.

Separating parameters from URL
If you are wondering how to separate a given complete URL with its parameters to use in Postman then Postman has it sorted out for you. You do not need to worry about the parameters in a URL. You can simply paste the URL and Postman will fill the parameters itself.

For example, copy and paste this URL inside your postman like shown below https://www.google.co.in/search?q=toolsqa&oq=toolsqa&aqs=chrome..69i57j69i60l5.2885j0j4&sourceid=chrome&ie=UTF-8

Now click on Params and you can see that everything is sorted out itself and the parameters are as in the above image (more or less).



Copy parameters to another Postman Request
Another interesting feature about Params is that Postman removes the headache of remembering and entering the same parameters again and again to every query, instead it lets you enter once and forget about entering the same parameters again. For example, let say you have to run the same query that we just run but with few less parameters. For achieving the same,

1. Click on Bulk Edit, you will see the list of all parameters


2. Copy everything



3. Open a new tab and write your URL which is www.google.com/search in this case



4. Click on Params, then Bulk Edit



5. Paste everything you copied in the editor and Click on Key-Value edit



Here you will see every parameter has been adjusted automatically to the new request.



This makes Postman really very efficient while using the parameter option and leaves us out of the context of its complexity. The parameter is a very important part of a URL and readers are recommended to observe the different parameters in a URL for better learning and understanding, whereas this was all about parameter usage inside Postman. Next, we will see the response in Postman.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.