nerdexam
Broadcom-VMware

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…

REST

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)
  • B
    96% (23)
  • C
    4% (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; POST is 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

#HTTP Methods#RESTful URL Design#Resource Identification#REST Conventions

Community Discussion

No community discussion yet for this question.

Full 2V0-72.22PSE Practice