FEAT Always return representation after write operation #78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR modifies the behavior of write operations in the system to ensure that a representation of the affected resource is always returned after a write operation (such as POST, PUT, or PATCH).
Type of change
Please delete options that are not relevant.
Checklist
Further comments
Returning a representation after a write operation aligns with common RESTful API practices and provides several benefits:
Immediate Feedback: After a resource is created, updated, or modified, the client needs confirmation of the result. Returning the updated resource provides immediate feedback to confirm that the operation was successful and how the resource looks after the change.
Reduced API Calls: By returning the resource immediately, the client does not need to make an additional GET request to retrieve the updated representation, reducing the number of API calls and improving efficiency.
Data Integrity Verification: Returning the resource enables the client to verify the integrity and consistency of the data after the write operation, ensuring that all fields are properly updated and no data is lost or modified incorrectly.
Standards Compliance: This approach follows REST principles, particularly the best practice of returning the new state of the resource after modifying it. For example, after a POST request to create a new resource, the API should return the newly created resource with all relevant fields (e.g., auto-generated ID or timestamps). Similarly, after a PUT or PATCH, the updated resource should be returned.