-
My application always sends the whole nested object structure to the api platform (2.7) to persist changes. Currently uses PUT that works just fine. There are several issues about this topic, still not sure what is the preferred way. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello Carobit,
Yes but only because we implemented the Merge-Patch format. There are other PATCH formats that one can implement to handle things differently. We're open to discussion to implement other standards, or one could build it in a library.
If a property is not exposed on your API, why would API Platform remove it (eg: set to null)? We need to check this but I don't think that it's the case. Using embedded resources on write is not great implementation-wise and induces lots of complexity. We suggest to follow the Edge Side API recommendation. We introduced core/docs/guides/return-the-iri-of-your-resources-relations.php Lines 194 to 199 in e65d2c3 Then if you need to update the collection you do this by removing/adding items on that resource instead. If you don't want to break your API you can always create a custom Symfony Normalizer that will support the old PUT behavior. Last but not least, we do recommend splitting Doctrine Entities from your API Resources, for example to not expose some fields. |
Beta Was this translation helpful? Give feedback.
Hello Carobit,
Yes but only because we implemented the Merge-Patch format. There are other PATCH formats that one can implement to handle things differently. We're open to discussion to implement other standards, or one could build it in a library.
If a property is not exposed on your API, why would API Platform remove it (eg: set to null)? We need to check this but I don't think that it's the case.
Using embedded resources on write is not great implementation-wise and induces lots of complexity. We sug…