Request Parameters in Postman
Request parameters are used to send additional information to the server. A URL contains these parameters. There are two types of parameters:
Query Parameter: These are appended to the end of the request URL, Query parameters are appended to the end of the request URL, following '?' and listed in key-value pairs, separated by '&' Syntax:
Path Parameters: These are part of the request URL, which are accessed using the placeholders preceded by ':' Example:
There are two ways of setting query parameters on a request in Postman.
Using URL Field
The most common way of adding parameters is- append the query string to the end of the URL.
Let's enter a URL in the URL text field:
Suppose we have the URL www.google.com/search when you click on send option you will get the following response:
Now try to enter the parameter in the following format:
Here 'q' is the key, and 'javatpoint' is the value of the key.
When you enter the parameter in the URL and select the send button then you will get the following response:
Using Params is the second way. This option is available on the left side of the URL text field. This option will offer you additional text fields under the URL field to enter the query parameters in the form of key-value pairs.
Once you enter parameters in the Params text field, then these parameters will automatically be added to the URL. The interface offers to keep your entered parameters in an organized way, which is very useful for the requests that require several parameters.
Let's see an example:
Enter the URL www.google.com/search in the URL text field:
And now go to the Params section:
Write the parameters under the key-value pair, as shown. Here, k is the query, and javatpoint is the search term.
Now press send button and look at the preview section of response window; you will get the following response:
We can also work with multiple parameters inside a single query. Just go to your browser and search in Google 'javatpoint'.
See the above image and URL; multiple parameters are sent in the URL.
In the above URL, '&' should be followed by a parameter such as &ie=UTF-8. In this parameter, i.e., is the key and, UTF-8 is the key-value.
Enter the same URL in the Postman text field; you will get the multiple parameters in the Params tab. Even you can write each of the parameters and send a request with multiple parameters.