@@ -90,16 +90,20 @@ implicitly creating the resource before updating
9090* on successful {PUT} requests, the server will *replace the entire resource*
9191addressed by the URL with the representation passed in the payload (subsequent
9292reads will deliver the same payload, plus possibly server-generated fields like `modified_at`)
93- * successful {PUT} requests will usually generate {200} or {204} (if the
94- resource was updated – with or without actual content returned), and {201} (if
95- the resource was created)
96-
97- *Important:* It is good practice to prefer {POST} over {PUT} for creation of
98- (at least top-level) resources. This leaves the resource identifier management under
99- control of the service and not the client, and focuses {PUT} on its usage for updates.
100- However, in situations where all resource attributes including the identifier
93+ * successful {PUT} requests return {200} or {204} (if the resource was updated -
94+ with or without returning the resource), {201} (if the resource was created)
95+ or {202} (if accepted and processed asynchronously).
96+
97+ The updated/created resource may be returned as response payload. We recommend,
98+ to not use it per default, but if the resource is enriched with server-generated
99+ fields like `version_number`. You may also support client side steering (see <<181>>).
100+
101+ *Important:* It is good practice to keep the resource identifier management under
102+ control of the service provider and not the client, and, hence, to prefer {POST} for
103+ creation of (at least top-level) resources, and focus {PUT} on its usage for updates.
104+ However, in situations where the identifier and all resource attributes
101105are under control of the client as input for the resource creation you should use
102- {PUT} and pass the resource identifier via the URL path.
106+ {PUT} and pass the resource identifier as URL path parameter .
103107Putting the same resource twice is required to be <<idempotent>> and to result
104108in the same single resource instance (see <<149>>) without data duplication in case of repetition.
105109
@@ -122,10 +126,9 @@ by the URL"_.
122126
123127* on a successful {POST} request, the server will create one or multiple new
124128resources and provide their URI/URLs in the response
125- * successful {POST} requests will usually generate {200} (if resources have
126- been updated), {201} (if resources have been created), {202} (if the request
127- was accepted but has not been finished yet), and exceptionally {204} with
128- {Location} header (if the actual resource is not returned).
129+ * successful {POST} requests return {200} or {204} (if the resource was updated -
130+ with or without returning the resource), {201} (if the resource was created)
131+ or {202} (if accepted and processed asynchronously).
129132
130133*Note:* By using {POST} to create resources the resource ID must not be passed as
131134request input date by the client, but created and maintained by the service and
@@ -159,8 +162,8 @@ collection is challenging
159162instances
160163* on successful {PATCH} requests, the server will update parts of the resource
161164addressed by the URL as defined by the change request in the payload
162- * successful {PATCH} requests will usually generate {200} or {204} (if
163- resources have been updated with or without updated content returned)
165+ * successful {PATCH} requests return {200} or {204} (if the resource was updated -
166+ with or without returning the resource).
164167
165168*Note:* since implementing {PATCH} correctly is a bit tricky, we strongly suggest
166169to choose one and only one of the following patterns per endpoint (unless
@@ -206,8 +209,8 @@ described as _"please delete the resource identified by the URL"_.
206209 collection resources, as this would imply deleting the entire collection.
207210* {DELETE} request can be applied to multiple resources at once using query
208211 parameters on the collection resource (see <<delete-with-query-params>>).
209- * successful {DELETE} requests will usually generate {200 } (if the deleted
210- resource is returned) or {204} (if no content is returned ).
212+ * successful {DELETE} requests return {200} or {204 } (if the resource was deleted -
213+ with or without returning the resource ).
211214* failed {DELETE} requests will usually generate {404} (if the resource cannot
212215 be found) or {410} (if the resource was already deleted before).
213216
@@ -374,6 +377,11 @@ If you mainly aim to support safe retries, we suggest to apply <<182,
374377conditional key>> and <<231,secondary key>> pattern before the <<230,
375378Idempotency Key>> pattern.
376379
380+ Note, like for {PUT}, successful {POST} or {PATCH} returns {200} or {204} (if the resource
381+ was updated - with or without returning the resource), or {201} (if resource was created).
382+ Hence, clients can differentiate successful robust repetition from resource created
383+ server activity of idempotent {POST}.
384+
377385
378386[#231]
379387== {Should} use secondary key for idempotent `POST` design
0 commit comments