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: core/operations.md
+15-13
Original file line number
Diff line number
Diff line change
@@ -17,28 +17,30 @@ is also possible.
17
17
18
18
There are two types of operations: collection operations and item operations.
19
19
20
-
Collection operations act on a collection of resources. By default two routes are implemented: `POST` and `GET`. Item
21
-
operations act on an individual resource. Four default routes are defined: `GET`, `PUT`, `DELETE` and `PATCH`. `PATCH` is supported
20
+
Collection operations act on a collection of resources. By default two operations are implemented: `POST` and `GET`. Item
21
+
operations act on an individual resource. Three default operation are defined: `GET`, `DELETE` and `PATCH`. `PATCH` is supported
22
22
with [JSON Merge Patch (RFC 7396)](https://www.rfc-editor.org/rfc/rfc7386), or [using the JSON:API format](https://jsonapi.org/format/#crud-updating), as required by the specification.
23
23
24
+
The `PUT` operation is also supported, but is not registered by default.
25
+
24
26
When the `ApiPlatform\Metadata\ApiResource` annotation is applied to an entity class, the following built-in CRUD
`PATCH` | no | Apply a partial modification to an element | yes
43
+
`DELETE` | no | Delete an element | yes
42
44
43
45
Note: the `PATCH` method must be enabled explicitly in the configuration, refer to the [Content Negotiation](content-negotiation.md) section for more information.
44
46
@@ -563,7 +565,7 @@ class Weather
563
565
// ...
564
566
```
565
567
566
-
This will expose the `Weather` model, but also all the default CRUD routes: `GET`, `PUT`, `PATCH`, `DELETE` and `POST`, which is nonsense in our context.
568
+
This will expose the `Weather` model, but also all the default CRUD routes: `GET`, `PATCH`, `DELETE` and `POST`, which is nonsense in our context.
567
569
Since we are required to expose at least one route, let's expose just one:
Copy file name to clipboardExpand all lines: distribution/index.md
+3-1
Original file line number
Diff line number
Diff line change
@@ -494,9 +494,11 @@ In Swagger UI, click on the `POST` operation of the `Book` resource type, click
494
494
You just saved a new book resource through the bookshop API! API Platform automatically transforms the JSON document to
495
495
an instance of the corresponding PHP entity class and uses Doctrine ORM to persist it in the database.
496
496
497
-
By default, the API supports `GET` (retrieve, on collections and items), `POST` (create), `PUT` (replace), `PATCH` (partial update) and `DELETE` (self-explanatory)
497
+
By default, the API supports `GET` (retrieve, on collections and items), `POST` (create), `PATCH` (partial update) and `DELETE` (self-explanatory)
498
498
HTTP methods. Don't forget to [disable the ones you don't want](../core/operations.md#enabling-and-disabling-operations)!
499
499
500
+
The `PUT` (replace or create) method is also supported, but is not enabled by default.
501
+
500
502
Try the `GET` operation on the collection. The book we added appears. When the collection contains more than 30 items,
501
503
the pagination will automatically show up, [and this is entirely configurable](../core/pagination.md). You may be interested
502
504
in [adding some filters and adding sorts to the collection](../core/filters.md) as well.
0 commit comments