0
0
Rest APIprogramming~20 mins

Noun-based resource naming in Rest API - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
RESTful Resource Naming Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the correct RESTful URL for accessing a single user resource?
Given a REST API that manages users, which URL correctly follows noun-based resource naming conventions to access the user with ID 42?
A/user/get/42
B/getUser?id=42
C/users/42
D/users/getUser/42
Attempts:
2 left
💡 Hint
Focus on using plural nouns and hierarchical paths without verbs.
Predict Output
intermediate
2:00remaining
Which URL correctly represents a collection of blog posts?
You want to design a REST API endpoint to retrieve all blog posts. Which URL follows noun-based resource naming best practices?
A/posts
B/getPosts
C/post/list
D/posts/getAll
Attempts:
2 left
💡 Hint
Use plural nouns without verbs or actions in the URL path.
🔧 Debug
advanced
2:00remaining
Identify the error in this RESTful URL design
Which option shows a RESTful URL that violates noun-based resource naming conventions by including a verb in the path?
A/orders/delete/123
B/orders/123
C/orders/123/items
D/orders/123/items/456
Attempts:
2 left
💡 Hint
RESTful URLs should avoid verbs in the path; HTTP methods indicate actions.
🧠 Conceptual
advanced
2:00remaining
What is the best URL to access comments for a specific blog post?
You have blog posts and each post has comments. Which URL correctly uses noun-based resource naming to get comments for post with ID 10?
A/comments?postId=10
B/posts/10/comments
C/getCommentsForPost/10
D/posts/comments/10
Attempts:
2 left
💡 Hint
Use nested resources with plural nouns in hierarchical order.
Predict Output
expert
2:00remaining
How many items are in the resulting resource collection?
Assume a REST API endpoint /products returns a JSON array of products. The response is:
[{"id":1,"name":"Pen"},{"id":2,"name":"Notebook"},{"id":3,"name":"Eraser"}]
How many items does this collection contain?
A0
B1
C2
D3
Attempts:
2 left
💡 Hint
Count the number of objects inside the JSON array.