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:
.google.com/search?q=madanswer
Here 'q' is the key, and 'madanswer' 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
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 is the search term.