I am using RESTlet and I have created a resource. I handle POST by overriding acceptRepresentation
method.
The client should send me some data, then I store it to DB, set response to 201 (SUCCESS_CREATED) and I need to return some data to the client, but return type of acceptRepresentation
is void
.
In my case, I need to return some identificator so that client can access that resource.
For example, if I had a resource with URL /resource
and the client sends POST request I add a new row in DB and its address should be /resource/{id}
. I need to send {id}
.
Am I doing something wrong? Does REST principles allow to return something after POST? If yes, how can I do it, and if no what is the way to handle this situation?