Design the rest interface. For the update,add,delete operation, it is said on the Internet that the modified result should be returned to the caller, and the caller can directly take advantage of the modified result. So whether the return result returns or a primary key id will the entire entity modified by , such as User, return .
question 1:
1 if returns a primary key id .
since the id of update and delete is already passed from the caller, it does not need to be returned. When add, the id is generated in the background, so it needs to be returned to the caller. In this way, even if the unified return object is encapsulated, it feels that the return json of API is still not uniform.
2 if returns the entity .
is not an api for a modification operation to operate the database twice (one modification, one query)
how do you design rest API? Is there any code to share? Thank you!