Recall & Review
beginner
Why should URLs avoid verbs in REST APIs?
URLs should avoid verbs because REST APIs use HTTP methods (GET, POST, PUT, DELETE) to express actions. URLs represent resources (nouns), making APIs clearer and easier to understand.
Click to reveal answer
beginner
What is a good example of a URL avoiding verbs?
A good URL example is
/users/123 to access user data. The action is defined by the HTTP method, like GET to retrieve or DELETE to remove the user.Click to reveal answer
beginner
What is wrong with this URL:
/getUser/123?It includes a verb 'get' in the URL, which is redundant because the HTTP GET method already means 'retrieve'. This breaks REST principles and can confuse API users.
Click to reveal answer
intermediate
How do HTTP methods relate to avoiding verbs in URLs?
HTTP methods define the action on a resource: GET retrieves, POST creates, PUT updates, DELETE removes. This means URLs only need to name resources, not actions.
Click to reveal answer
intermediate
Give an example of a RESTful URL and HTTP method to update a product.
Use URL
/products/456 with HTTP PUT method. The URL identifies the product resource, and PUT tells the server to update it.Click to reveal answer
Which part of a REST API URL should you avoid?
✗ Incorrect
Verbs in URLs are redundant because HTTP methods already define actions.
What HTTP method is used to delete a resource?
✗ Incorrect
DELETE method tells the server to remove the specified resource.
Which URL is more RESTful?
✗ Incorrect
The URL '/users' represents the resource; actions are handled by HTTP methods.
How do you update a user with ID 789 in a REST API?
✗ Incorrect
Use PUT method on the resource URL to update it.
Why is '/getOrders' a bad URL in REST?
✗ Incorrect
The verb 'get' is redundant because HTTP GET method already means retrieve.
Explain why REST API URLs should avoid verbs and how HTTP methods relate to this.
Think about how you tell a friend what to do using verbs versus naming things.
You got /4 concepts.
Describe a RESTful way to design a URL and HTTP method for deleting a product with ID 101.
Focus on naming the thing and using the right HTTP method for the action.
You got /4 concepts.