How to implement a RESTful PUT URL if the primary key is unknown before the resource is created?

I see how this will work:

/ user / 456

with GET, POST and DELETE, but not with PUT, if the caller somehow does not know the next primary key or he himself ... how to do it?

I read here: PUT vs POST in REST

The PUT method requests that the enclosed object be stored under the provided Request-URI.

+3
source share
1 answer
  • The client must send a POST request /userto create resources.
  • Then the server should return a response 201 CREATED, with the resource URI in Location.
  • GET/PUT/DELETE URI // .
+7

All Articles