0
0
Rest APIprogramming~10 mins

Link headers for navigation 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 Link header for the next page URL.

Rest API
response.headers['Link'] = '<[1]>; rel="next"'
Drag options to blanks, or click blank then click option'
A/items?page=3
Bitems?page=2
Chttps://api.example.com/items?page=1
Dhttps://api.example.com/items?page=2
Attempts:
3 left
💡 Hint
Common Mistakes
Using a relative URL instead of a full absolute URL.
Forgetting to enclose the URL in angle brackets.
2fill in blank
medium

Complete the code to add Link headers for both previous and next pages.

Rest API
response.headers['Link'] = '<[1]>; rel="prev", <https://api.example.com/items?page=3>; rel="next"'
Drag options to blanks, or click blank then click option'
Ahttps://api.example.com/items?page=4
Bhttps://api.example.com/items?page=2
Chttps://api.example.com/items?page=1
D/items?page=1
Attempts:
3 left
💡 Hint
Common Mistakes
Using a relative URL for the previous page.
Mixing up the page numbers for prev and next.
3fill in blank
hard

Fix the error in the Link header format to correctly separate multiple links.

Rest API
response.headers['Link'] = '<https://api.example.com/items?page=1>; rel="prev"[1]<https://api.example.com/items?page=3>; rel="next"'
Drag options to blanks, or click blank then click option'
A;
B,
C &
D |
Attempts:
3 left
💡 Hint
Common Mistakes
Using semicolon or other characters instead of a comma.
Not adding a space after the comma.
4fill in blank
hard

Fill both blanks to create a Link header with first and last page URLs.

Rest API
response.headers['Link'] = '<[1]>; rel="first", <[2]>; rel="last"'
Drag options to blanks, or click blank then click option'
Ahttps://api.example.com/items?page=1
Bhttps://api.example.com/items?page=2
Chttps://api.example.com/items?page=10
D/items?page=10
Attempts:
3 left
💡 Hint
Common Mistakes
Using relative URLs instead of full URLs.
Mixing up first and last page numbers.
5fill in blank
hard

Fill all three blanks to build a Link header with prev, next, and last page URLs.

Rest API
response.headers['Link'] = '<[1]>; rel="prev", <[2]>; rel="next", <[3]>; rel="last"'
Drag options to blanks, or click blank then click option'
Ahttps://api.example.com/items?page=2
Bhttps://api.example.com/items?page=4
Chttps://api.example.com/items?page=10
Dhttps://api.example.com/items?page=3
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping prev and next URLs.
Using relative URLs instead of full URLs.