0
0
Rest APIprogramming~20 mins

Avoiding verbs in URLs in Rest API - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
REST URL Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
REST API URL Design: Identify the Correct Resource URL

Which URL best follows REST API principles by avoiding verbs and focusing on resources?

A/users/create
B/createUser
C/users
D/add-user
Attempts:
2 left
💡 Hint

Think about URLs as nouns representing resources, not actions.

🧠 Conceptual
intermediate
1:30remaining
Why Avoid Verbs in REST API URLs?

What is the main reason to avoid verbs in REST API URLs?

ABecause HTTP methods already specify the action, so URLs should represent resources
BBecause verbs make URLs longer and harder to read
CBecause verbs cause security issues in APIs
DBecause verbs are not supported by all browsers
Attempts:
2 left
💡 Hint

Consider how HTTP methods and URLs work together in REST.

🔧 Debug
advanced
2:00remaining
Identify the Problem with This REST API URL

Look at this URL used in a REST API: /deleteOrder/123. What is the main issue with this URL design?

AIt uses a verb 'delete' in the URL instead of relying on HTTP DELETE method
BThe order ID should be a query parameter, not part of the URL path
CThe URL should be uppercase for better readability
DIt should use POST method instead of DELETE
Attempts:
2 left
💡 Hint

Think about how REST APIs separate actions from resource paths.

📝 Syntax
advanced
1:30remaining
Choose the Correct RESTful URL for Updating a User

Which URL correctly follows RESTful design principles for updating a user with ID 45?

A/updateUser/45
B/users/45
C/users/update/45
D/users?id=45&action=update
Attempts:
2 left
💡 Hint

Remember, URLs should represent resources, and HTTP methods specify the action.

🚀 Application
expert
2:30remaining
Design a REST API URL for Filtering Products by Category

You want to design a REST API URL to get products filtered by category 'electronics'. Which URL follows REST principles best?

A/getElectronicsProducts
B/products/electronics
C/filterProducts/category/electronics
D/products?category=electronics
Attempts:
2 left
💡 Hint

Think about how to represent filtering in REST APIs using query parameters.