0
0
Rest APIprogramming~10 mins

Keyset pagination for performance 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 keyset pagination parameter to the API endpoint.

Rest API
GET /items?[1]=100
Drag options to blanks, or click blank then click option'
Aoffset
Bpage
Clast_id
Dlimit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'page' or 'offset' which are for offset pagination, not keyset pagination.
2fill in blank
medium

Complete the SQL WHERE clause to implement keyset pagination using the last seen ID.

Rest API
SELECT * FROM items WHERE id [1] ? ORDER BY id ASC LIMIT 10
Drag options to blanks, or click blank then click option'
A>
B<=
C=
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' which would fetch previous items instead of next.
3fill in blank
hard

Fix the error in the API query parameter for keyset pagination.

Rest API
GET /items?[1]=abc123
Drag options to blanks, or click blank then click option'
Aoffset
Blast_id
Cpage
Dlimit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'page' or 'offset' which are for offset pagination.
4fill in blank
hard

Fill both blanks to complete the SQL query for keyset pagination with a timestamp cursor.

Rest API
SELECT * FROM events WHERE event_time [1] ? ORDER BY event_time [2] LIMIT 20
Drag options to blanks, or click blank then click option'
A>
B<
CASC
DDESC
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' and DESC which would fetch older events in reverse order.
5fill in blank
hard

Fill all three blanks to complete the Python function that builds a keyset pagination query.

Rest API
def get_items_query(last_id):
    query = "SELECT * FROM items WHERE id [1] [2] ORDER BY id [3] LIMIT 10"
    return query
Drag options to blanks, or click blank then click option'
A>
B?
CASC
DDESC
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' or 'DESC' which would reverse the pagination order.
Forgetting to use a parameter placeholder.