Hello,
I would like to find a way to configure a Resource for returning nothing after creation (instead of created resource).
My use case :
- I have a PasswordReset resource (int id, string secret, bool used, User user)
- I have an endpoint POST /password-reset, witch create a new PasswordReset resource.
- I have an endpoint HEAD /password-reset/{id}/{secret}, who return 200 if resource exist.
- I have an endpoint POST /password-reset/{id}/{secret}, who create a new password for the user.
Obviously, I don't want the POST /password-reset to return the resource after creation. (the secret will be sent by mail to the user).
Furthermore, I don't want a GET /password-reset/{id} because it's useless.
Right now, when I call POST /password-reset, an InvalidArgumentException is throw with message "No route associated with the type "AppBundle\Entity\PasswordReset" because no GET /password-reset/{id} exist.
So I propose to add an attribute "returnResource" with default to true to the Resource annotation. And when to false, the operation return no data.
I can work on a patch.
Hello,
I would like to find a way to configure a Resource for returning nothing after creation (instead of created resource).
My use case :
- I have a PasswordReset resource (int id, string secret, bool used, User user)
- I have an endpoint POST /password-reset, witch create a new PasswordReset resource.
- I have an endpoint HEAD /password-reset/{id}/{secret}, who return 200 if resource exist.
- I have an endpoint POST /password-reset/{id}/{secret}, who create a new password for the user.
Obviously, I don't want the POST /password-reset to return the resource after creation. (the secret will be sent by mail to the user).
Furthermore, I don't want a GET /password-reset/{id} because it's useless.
Right now, when I call POST /password-reset, an InvalidArgumentException is throw with message "No route associated with the type "AppBundle\Entity\PasswordReset" because no GET /password-reset/{id} exist.
So I propose to add an attribute "returnResource" with default to true to the Resource annotation. And when to false, the operation return no data.
I can work on a patch.