You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/asciidoc/repository-resources.adoc
+12-2Lines changed: 12 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -35,9 +35,11 @@ For the resources exposed, we use a set of default status codes:
35
35
36
36
* `200 OK`: For plain `GET` requests.
37
37
* `201 Created`: For `POST` and `PUT` requests that create new resources.
38
-
* `204 No Content`: For `PUT`, `PATCH`, and `DELETE` requests when the configuration is set to not return response bodies for resource updates (`RepositoryRestConfiguration.returnBodyOnUpdate`). If the configuration value is set to include responses for `PUT`, `200 OK` is returned for updates, and `201 Created` is returned for resource created through `PUT`.
38
+
* `204 No Content`: For `PUT`, `PATCH`, and `DELETE` requests when the configuration is set to not return response bodies for resource updates (`RepositoryRestConfiguration.setReturnBodyOnUpdate(…)`).
39
+
If the configuration value is set to include responses for `PUT`, `200 OK` is returned for updates, and `201 Created` is returned for resource created through `PUT`.
39
40
40
-
If the configuration values (`RepositoryRestConfiguration.returnBodyOnUpdate` and `RepositoryRestConfiguration.returnBodyCreate)` are explicitly set to `null`, the presence of the HTTP Accept header is used to determine the response code.
41
+
If the configuration values (`RepositoryRestConfiguration.returnBodyOnUpdate(…)` and `RepositoryRestConfiguration.returnBodyCreate(…)`) are explicitly set to `null` -- which they are by default --, the presence of the HTTP Accept header is used to determine the response code.
42
+
Read more on this in the detailed description of <<repository-resources.collection-resource.supported-methods.post, collection>> and <<repository-resources.item-resource.supported-methods.put, item resources>>.
41
43
42
44
[[repository-resources.resource-discoverability]]
43
45
=== Resource Discoverability
@@ -144,6 +146,10 @@ For more information on the default exposure of methods, see <<repository-resour
144
146
==== `POST`
145
147
146
148
The `POST` method creates a new entity from the given request body.
149
+
By default, whether the response contains a body is controlled by the `Accept` header sent with the request.
150
+
If one is sent, a response body is created.
151
+
If not, the response body is empty and a representation of the resource created can be obtained by following link contained in the `Location` response header.
152
+
This behavior can be overridden by configuring `RepositoryRestConfiguration.setReturnBodyOnCreate(…)` accordingly.
147
153
148
154
===== Methods used for invocation
149
155
@@ -223,6 +229,10 @@ For more information on the default exposure of methods, see <<repository-resour
223
229
==== `PUT`
224
230
225
231
The `PUT` method replaces the state of the target resource with the supplied request body.
232
+
By default, whether the response contains a body is controlled by the `Accept` header sent with the request.
233
+
If the request header is present, a response body and a status code of `200 OK` is returned.
234
+
If no header is present, the response body is empty and a successful request returns a status of `204 No Content`.
235
+
This behavior can be overridden by configuring `RepositoryRestConfiguration.setReturnBodyOnUpdate(…)` accordingly.
0 commit comments