I am using a restlate and I have created a resource. I handle the post while overriding the method of accepting the acceptance.
The customer should send me some data, then I store it in DB, send feedback on 201 (SUCCESS_CREATED) and I need to return some data to the customer, but the type of return accepted is zero submission. .
In my case, I need to return some identifier so that customers can reach that resource. For example, if I had a resource with url / resource and client, post request I would add new row to db and its address / resource / {id} should be. I need to send {ID}.
Am I doing something wrong? Are some principles allowed to return something after POST? If so, how can I do this, and if there is no way to handle this situation?
The rest simply say that you should be consistent with the same interface. In other words, it says what you should do that should be done according to the post. Here is the quote from that specific statement, which is relevant,
If a source is created on the original server, then the reaction should be 201 (manufactured) and there is an entity which is Describes requests and new resources, and location headers (see Section 14.30).
As you can see from it, you have two places where you can point to the client where the new resource is created, there should be a URL in the top of the place which will be the new resource And you can return a unit with details.
I'm not sure the overriding acceptance report () and override post () illustrates how to return a response to a POST.
No comments:
Post a Comment