3

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 method requests that the enclosed entity be stored under the supplied Request-URI.

Community
  • 1
  • 1
MetaGuru
  • 42,847
  • 67
  • 188
  • 294
  • 1
    I believe in that link they recommend that if the server is the one that determines the resulting resource's uri, that POST should be used, not PUT. – Paul DelRe Jun 08 '11 at 18:12

1 Answers1

7
  1. The client should send a POST request to /user to create the resource.
  2. The server should then return a 201 CREATED response, with the URI of the resource in the Location header.
  3. The client can then GET/PUT/DELETE from the URI it's been given to read/update/delete the resource.
Tom Christie
  • 33,394
  • 7
  • 101
  • 86