Peripli / specification

Service Manager Specification
Apache License 2.0
11 stars 4 forks source link

POST vs PUT for create & IDs #32

Open duglin opened 6 years ago

duglin commented 6 years ago

To register (or create) a new platform resource we do: POST /v1/platforms and the ID of the platform is in the HTTP Body.

We can then later get info about that platform (or update it) via /v1/platforms/:ID.

1) it seems to me that if we're going to have the client pass in the ID then it should be a PUT to the v1/platforms/:ID URL not a POST since POST is typically for when the server is going to decide things like the resource's ID and final URL.

2) should the client pick the ID at all? What is the benefit of forcing the client to pick a globally unique value? Is it just for easy reference later on? If so, what is the benefit of using that ID as part of the URL? When we allow some other system to pick our unique IDs then we run the risk of them needing to change them later on - or (forever) maintain a mapping. E.g. what if they need to update the ID? I'm wondering if ID should just be a field of the resource but not part of the URL of the resource. Then clients can update the ID if they need to w/o the URL of the resource changing. Since we're not bound by the "brokers are stateless" constraints, we don't need to force the client to provide info on behalf of the server.