How would I implement RESTful PUT URLs if the primary key is unknown before the resource is created?
I can see how this would work:
/user/456
with GET, POST, and DELETE but not with PUT unless the caller somehow knows the next primary key or they provide it themselves... how is this done?
I am going by what I read here: PUT vs POST in REST
The PUT me开发者_如何学JAVAthod requests that the enclosed entity be stored under the supplied Request-URI.
- The client should send a
POSTrequest to/userto create the resource. - The server should then
return a
201 CREATEDresponse, with the URI of the resource in theLocationheader. - The client can
then
GET/PUT/DELETEfrom the URI it's been given to read/update/delete the resource.
加载中,请稍侯......
精彩评论