2V0-72.22PSE · Question #76
According to REST principles, which is the recommended way to update the order resource identified by 1234?
The correct answer is B. Send a PUT request to /orders/1234. B is correct because REST uses resource-based URLs where the identifier is part of the path (/orders/1234), and PUT is the idiomatic HTTP method for replacing/updating an existing resource at a known URI. Why the others are wrong: A (/orders/edit?id=1234) violates REST by…
Question
According to REST principles, which is the recommended way to update the order resource identified by 1234?
Options
- ASend a PUT request to /orders/edit?id=1234.
- BSend a PUT request to /orders/1234.
- CSend a POST request to /orders/1234.
- DSend a POST request to /orders/edit?id=1234.
How the community answered
(24 responses)- B96% (23)
- C4% (1)
Explanation
B is correct because REST uses resource-based URLs where the identifier is part of the path (/orders/1234), and PUT is the idiomatic HTTP method for replacing/updating an existing resource at a known URI.
Why the others are wrong:
- A (
/orders/edit?id=1234) violates REST by encoding the action ("edit") in the URL and hiding the identifier in a query string - REST URLs should identify resources, not actions. - C (
POST /orders/1234) uses the wrong method;POSTis for creating new resources or submitting data to a processor, not updating a specific known resource. - D (
POST /orders/edit?id=1234) commits both mistakes: wrong method (POST) and action-based URL with a query string identifier.
Memory tip: Think of REST URLs as nouns (resources), not verbs (actions) - /orders/1234 names a thing, while /orders/edit names an action. Then map the verb to the HTTP method: PUT = Update/Replace.
Topics
Community Discussion
No community discussion yet for this question.