0
0
Rest APIprogramming~10 mins

Hierarchical resource paths 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 define a hierarchical REST API path for accessing a user's posts.

Rest API
GET /users/[1]/posts
Drag options to blanks, or click blank then click option'
A{userId}
B:userId
CuserId
D<userId>
Attempts:
3 left
💡 Hint
Common Mistakes
Using curly braces instead of colon notation for path parameters.
Omitting the colon and just writing the parameter name.
2fill in blank
medium

Complete the code to define a nested resource path for accessing a specific comment on a post.

Rest API
GET /posts/[1]/comments/[2]
Drag options to blanks, or click blank then click option'
A:postId
B{postId}
C:commentId
D{commentId}
Attempts:
3 left
💡 Hint
Common Mistakes
Using the comment ID in place of the post ID in the first parameter.
Using curly braces instead of colon notation.
3fill in blank
hard

Fix the error in the hierarchical path to correctly access a user's specific order.

Rest API
GET /users/[1]/orders/[2]
Drag options to blanks, or click blank then click option'
A{orderId}
B:orderId
C{userId}
D:userId
Attempts:
3 left
💡 Hint
Common Mistakes
Using the order ID as the first parameter.
Using curly braces instead of colon notation.
4fill in blank
hard

Fill both blanks to define a REST API path for accessing a specific chapter of a book.

Rest API
GET /books/[1]/chapters/[2]
Drag options to blanks, or click blank then click option'
A:bookId
B:chapterId
C{chapterId}
D{bookId}
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of parameters.
Using curly braces instead of colon notation.
5fill in blank
hard

Fill all three blanks to define a REST API path for accessing a specific episode of a season of a TV show.

Rest API
GET /shows/[1]/seasons/[2]/episodes/[3]
Drag options to blanks, or click blank then click option'
A:showId
B:seasonId
C:episodeId
D{episodeId}
Attempts:
3 left
💡 Hint
Common Mistakes
Using curly braces for parameters.
Mixing the order of parameters.