Recall & Review
beginner
What are query parameters in a REST API?
Query parameters are key-value pairs added to the end of a URL to send extra information to the server, often used to filter or sort data.
Click to reveal answer
beginner
How do you add multiple filters using query parameters?
You add multiple filters by separating each key-value pair with an ampersand (&) in the URL, like ?color=red&size=medium.
Click to reveal answer
beginner
Example: What does this URL filter? <br>
/products?category=books&price_lt=20It filters products to show only those in the 'books' category with a price less than 20.
Click to reveal answer
intermediate
Why use query parameters for filtering instead of sending data in the request body?
Query parameters are part of the URL and are ideal for GET requests to retrieve filtered data without changing server state, while request bodies are used for POST or PUT requests.
Click to reveal answer
intermediate
What is a common naming convention for query parameters used to filter by comparison (e.g., less than, greater than)?
Common conventions add suffixes like _lt (less than), _gt (greater than), _lte (less than or equal to), _gte (greater than or equal to) to the parameter name.
Click to reveal answer
Which symbol starts query parameters in a URL?
✗ Incorrect
Query parameters start after a question mark (?) in the URL.
How do you separate multiple query parameters?
✗ Incorrect
Multiple query parameters are separated by an ampersand (&).
What HTTP method usually uses query parameters for filtering?
✗ Incorrect
GET requests commonly use query parameters to filter data without changing server state.
What does the query parameter
price_gte=10 mean?✗ Incorrect
The suffix _gte means 'greater than or equal to'.
Which URL filters products by color red and size medium?
✗ Incorrect
Query parameters use key=value pairs separated by &.
Explain how query parameters are used to filter data in a REST API.
Think about how URLs change when you want to see only certain items.
You got /5 concepts.
Describe common naming conventions for query parameters that filter by comparison operators.
Suffixes help specify how to compare values.
You got /5 concepts.