0
0
Rest APIprogramming~10 mins

Pagination metadata in response 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 include the total number of items in the pagination metadata.

Rest API
{
  "data": items,
  "pagination": {
    "total": [1]
  }
}
Drag options to blanks, or click blank then click option'
Aitems.count()
Btotal_items
Clen(items)
Dcount(items)
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method that does not exist on the list object.
Using a variable name that is not defined.
2fill in blank
medium

Complete the code to add the current page number to the pagination metadata.

Rest API
{
  "data": items,
  "pagination": {
    "page": [1]
  }
}
Drag options to blanks, or click blank then click option'
AcurrentPage
Bpage_number
Cpage
DpageNum
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable that is not defined in the context.
Using a string literal instead of a variable.
3fill in blank
hard

Fix the error in the code to correctly include the number of items per page in the pagination metadata.

Rest API
{
  "data": items,
  "pagination": {
    "per_page": [1]
  }
}
Drag options to blanks, or click blank then click option'
ApageSize
BitemsPerPage
CperPage
Dpage_size
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names that are not defined or inconsistent.
Using snake_case instead of camelCase if the code style requires it.
4fill in blank
hard

Fill both blanks to include the total pages and current page in the pagination metadata.

Rest API
{
  "data": items,
  "pagination": {
    "total_pages": [1],
    "current_page": [2]
  }
}
Drag options to blanks, or click blank then click option'
AtotalPages
BcurrentPage
Cpage_number
Dtotal_pages
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing variable names or using inconsistent naming conventions.
Using string literals instead of variables.
5fill in blank
hard

Fill all three blanks to include total items, items per page, and current page in the pagination metadata.

Rest API
{
  "data": items,
  "pagination": {
    "total_items": [1],
    "items_per_page": [2],
    "current_page": [3]
  }
}
Drag options to blanks, or click blank then click option'
AtotalItems
BitemsPerPage
CcurrentPage
DpageNumber
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing variable names or using inconsistent naming styles.
Using variables that are not defined in the context.