API Fundamentals Course
API Fundamentals
/
Beginner

Query Parameters

Definition

Optional key-value pairs appended to the very end of a URL after a question mark (`?`), used primarily to filter, sort, or paginate data in a GET request.

Explain Like I'm New

If the URL is a filing cabinet (`/users`), Query Parameters are the specific instructions to the librarian on how to search the cabinet (`?age=25&sort=name`).

Real World Example

Searching for red shoes on Amazon: `amazon.com/products?category=shoes&color=red&max_price=50`.

Common Use Cases

  • •Filtering data
  • •Pagination
  • •Sorting lists
  • •Search bars

Interactive Example

Loading...
Console output will appear here...

Interview Questions

basic

  • What character is used to separate multiple query parameters from each other in a URL?

intermediate

  • Why shouldn't you put a user's password in a query parameter?

Flash Cards

Question

Which character?

Click to reveal answer
Answer

The ampersand (`&`). Example: `?name=John&age=30`.

Question

Why no passwords?

Click to reveal answer
Answer

Query parameters are fully visible in the browser's address bar. They are also permanently saved in the browser's history and recorded in plain text in backend server logs. Passwords must go in the encrypted Request Body.