Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set the sort direction to ascending.
Rest API
params = {"sort": "name", "direction": "[1]"} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'desc' instead of 'asc' for ascending order.
✗ Incorrect
The correct sort direction for ascending order is "asc".
2fill in blank
mediumComplete the code to set the sort direction to descending.
Rest API
params = {"sort": "date", "direction": "[1]"} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'asc' instead of 'desc' for descending order.
✗ Incorrect
The correct sort direction for descending order is "desc".
3fill in blank
hardFix the error in the sort direction value to make it valid.
Rest API
params = {"sort": "price", "direction": "[1]"} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using full words instead of 'asc' or 'desc'.
✗ Incorrect
The API expects 'asc' or 'desc' for direction. 'desc' is the correct value for descending.
4fill in blank
hardFill both blanks to create a query with ascending sort on 'title'.
Rest API
params = {"sort": "[1]", "direction": "[2]"} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up sort field and direction values.
✗ Incorrect
The sort field should be 'title' and direction 'asc' for ascending order.
5fill in blank
hardFill all three blanks to create a query sorting by 'rating' descending.
Rest API
params = {"sort": "[1]", "direction": "[2]", "limit": [3] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong field or direction, or putting limit as a string.
✗ Incorrect
Sort by 'rating' with direction 'desc' and limit results to 10.