DEV Community

Cover image for Understanding Params and Query Params: A Simple Guide
Surbhi Dighe
Surbhi Dighe

Posted on

Understanding Params and Query Params: A Simple Guide

Have you ever looked at a web address and felt like what are these jumble of letters and symbols? These are nothing but the two friendly helpers called "params" and "query params".

In the context of web development and APIs, "params" and "query params" generally refer to different aspects of passing information in a URL or web address, particularly in the context of HTTP requests.
Understanding these terms is easier than you might think.

Let's take an example of a library website so that it will be easier to understand.

Params - They are the parameters that are part of the URL path itself. Let's imagine, if a website is like a library, the params are like telling it which book you want to read.

For example - in below URL, "bookname" is a param in the path.

https://library.com/book/bookname

Query Params - They are included in the URL after a question mark (?) and are used to pass key-value pairs as part of the URL query string.

For example - in below URL, the author and category parameters are part of the query string. It is like Hey, can you show me books about action by surbhi?"

https://library.com/book?author=surbhi&category=action

In summary, "params" generally refer to the parameters that are added in the path of the URL, while "query params" refer to the parameters in the query string. Both are different ways to pass data to a server or application, but they serve different purposes and are used in different parts of the URL.

Happy Reading!!

Top comments (0)