0
0
Postmantesting~10 mins

Query parameters in Postman - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a query parameter named 'user' with value '123' in Postman.

Postman
pm.request.url.addQueryParams({ user: [1] });
Drag options to blanks, or click blank then click option'
A'123'
B'user'
C'value'
D'param'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the key instead of the value for the parameter.
Forgetting to put quotes around the value.
2fill in blank
medium

Complete the code to retrieve the value of the query parameter 'page' from the request URL in Postman.

Postman
const page = pm.request.url.query.get([1]);
Drag options to blanks, or click blank then click option'
A'page'
B'limit'
C'offset'
D'user'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong key name that does not exist in the query parameters.
Not using quotes around the key name.
3fill in blank
hard

Fix the error in the code to correctly add a query parameter in Postman.

Postman
pm.request.url.query.add({ key: 'sort', value: [1] });
Drag options to blanks, or click blank then click option'
Adesc
B'desc'
Csort
D'sort'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the value without quotes causing a syntax error.
Using the key name as the value.
4fill in blank
hard

Fill both blanks to create a query parameter object with key 'filter' and value 'active' in Postman.

Postman
const param = { key: [1], value: [2] };
Drag options to blanks, or click blank then click option'
A'filter'
B'active'
C'status'
D'inactive'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping key and value.
Forgetting quotes around strings.
5fill in blank
hard

Fill all three blanks to create a query parameter object with key 'category', value 'books', and add it to the request URL in Postman.

Postman
const param = { key: [1], value: [2] };
pm.request.url.query.add([3]);
Drag options to blanks, or click blank then click option'
A'category'
B'books'
Cparam
D'items'
Attempts:
3 left
💡 Hint
Common Mistakes
Using strings instead of the param object when adding.
Missing quotes around key or value.