Introducing Query Param Rule

Modification of query parameters is one of the most popular feature requests we have received after script execution feature. We are very excited to announce the release of QueryParam as a new rule type. If you are not able to see QueryParam rule type, please update your extension by following this guide.

Use Cases

Query Parameters is important part of URL. When you want to pass data in HTTP Get request, that data is sent in the form of query params. Thus QueryParam rule can be extremely useful to test server’s behaviour with different query parameter. Query Params Rule can be used to perform the following modifications on a given url:

  1. RemoveAll parameters.
  2. Add parameter.
  3. Remove a specific parameter.

How to Create Query Param Rule

Please follow these steps to create Query Params rule in Requestly.

Click on Add Icon present in toolbar on Rules Page

Add Icon to create new rule

Select Query Param Rule

Since Requestly supports multiple rule types, when you click on Add Icon, it takes you to Rule Type selection page. Click on Query Param Rule Card to create a new Query Param Rule.

Query Param Rule Selection

Create Query Param Rule

Based on your use case, you can populate different fields in Rule Editor. For Example, In this case we are adding dl=1 param to urls which contain dropbox.com

Query Params Rule Editor

Examples

Example 1 — Add Parameter “c” when url contains “foo”

Add Param c=3 when url contains foo

Example 2 — Remove All params and then add parameters “a” and “b” when url contains “example”

Remove Params and Add new Params example

FAQ

Q1. If I add a parameter by QueryParam rule and the same parameter already exists in the given url, will Requestly overwrite the parameter value ?
Ans: Yes, Requestly will overwrite the value present in the url to the value given in the rule. For example:

Rule Definition:
Url Contains example.com
Add Param “a” Value “200”

When Requestly gets above query param rule definition and the request url is http://www.example.com?a=100, then it will change the param value to 200 as per the rule and the new url will be http://www.example.com?a=200

Q2. What is the difference between “Remove” and “RemoveAll” ?
Ans: RemoveAll will remove all the parameters while Remove will remove only provided parameter.

 

That’s all to cover in this article. Feel free to reach out to us for any questions you have. Drop a comment if you have any suggestions to improve this post.


Leave a Reply

Your email address will not be published. Required fields are marked *