0
0
Rest APIprogramming~10 mins

Sorting with sort parameter 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 add a sort parameter to the API URL that sorts users by age.

Rest API
GET /api/users?sort=[1]
Drag options to blanks, or click blank then click option'
Aage
Bname
Cdate
Demail
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'name' or other fields instead of 'age' when the task asks to sort by age.
2fill in blank
medium

Complete the code to add a sort parameter that sorts products by price in descending order.

Rest API
GET /api/products?sort=[1]
Drag options to blanks, or click blank then click option'
A-price
Bprice
Cprice_desc
Ddesc_price
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'price' which sorts ascending by default.
Using 'price_desc' or 'desc_price' which are not standard.
3fill in blank
hard

Fix the error in the URL to sort orders by date in ascending order.

Rest API
GET /api/orders?sort=[1]
Drag options to blanks, or click blank then click option'
Adate_asc
B-date
Casc_date
Ddate
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-date' which sorts descending.
Using 'asc_date' or 'date_asc' which are not standard.
4fill in blank
hard

Fill both blanks to sort employees by last name ascending and then by hire date descending.

Rest API
GET /api/employees?sort=[1],[2]
Drag options to blanks, or click blank then click option'
Alast_name
B-hire_date
Chire_date
D-last_name
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing the order or using wrong prefixes.
5fill in blank
hard

Fill all three blanks to sort products by category ascending, then by price descending, then by rating ascending.

Rest API
GET /api/products?sort=[1],[2],[3]
Drag options to blanks, or click blank then click option'
Acategory
B-price
Crating
D-category
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong prefixes or wrong order of fields.