0
0
Rest APIprogramming~10 mins

Why URL structure communicates meaning in Rest API - Test Your Understanding

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

Complete the code to define a REST API endpoint that retrieves all users.

Rest API
GET /[1]
Drag options to blanks, or click blank then click option'
Afetch_all
BgetUsers
Cusers
Dlist
Attempts:
3 left
💡 Hint
Common Mistakes
Using verbs like 'getUsers' in the URL instead of resource names.
2fill in blank
medium

Complete the URL to access a specific user by their ID.

Rest API
GET /users/[1]
Drag options to blanks, or click blank then click option'
Aname
Btype
Caction
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using generic terms like 'name' or 'type' which may not uniquely identify a user.
3fill in blank
hard

Fix the error in the URL that tries to update a user's email.

Rest API
PUT /users/[1]/updateEmail
Drag options to blanks, or click blank then click option'
Aid
Bupdate
Cemail
Duser
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'updateEmail' as part of the URL path instead of relying on HTTP PUT method.
4fill in blank
hard

Fill both blanks to create a URL that lists all orders for a specific user.

Rest API
GET /[1]/[2]/orders
Drag options to blanks, or click blank then click option'
Ausers
Bproducts
C123
Dorders
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'products' or 'orders' in the wrong place in the URL.
5fill in blank
hard

Fill all three blanks to create a URL that accesses a specific comment on a post by a user.

Rest API
GET /[1]/[2]/posts/[3]/comments
Drag options to blanks, or click blank then click option'
Ausers
B456
C789
Dposts
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of user and post IDs or using wrong resource names.