0
0
Rest APIprogramming~10 mins

Sort direction (asc, desc) in Rest API - Interactive Code Practice

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

Complete 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'
Adesc
Bdown
Cup
Dasc
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'desc' instead of 'asc' for ascending order.
2fill in blank
medium

Complete 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'
Aup
Basc
Cdesc
Ddown
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'asc' instead of 'desc' for descending order.
3fill in blank
hard

Fix 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'
Aupward
Bdesc
Cdownward
Dascending
Attempts:
3 left
💡 Hint
Common Mistakes
Using full words instead of 'asc' or 'desc'.
4fill in blank
hard

Fill 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'
Atitle
Basc
Cdesc
Ddate
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up sort field and direction values.
5fill in blank
hard

Fill 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'
Adate
Bdesc
C10
Drating
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong field or direction, or putting limit as a string.