[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Pulp-list] Returning created objects from "POST" APIs?



On 11/23/2011 03:05 AM, Nick Coghlan wrote:
In working on the test suite for the new pulpdist plugins, I was
reminded of a practice some folks recommend for REST APIs that Pulp
currently doesn't implement: for a successful POST request, return the
object as if it had been a GET request.

The rationale is that there may be state in the object that the server
populates rather than the client. If a policy of "always return the
created object" is followed, then clients don't need to know whether or
not that is the case, nor do they have to make a second round trip to
the server (with a GET request) when it *is* the case.

Essentially, the idea is that, if this API pattern is followed, then:

server.POST(collection_path, obj_id, details)
obj = server.GET(collection_path, obj_id)

can consistently be replaced by:

obj = server.POST(collection_path, obj_id, details)

While there's no additional state added by the server when you create a
new repo, the same can't be said for arbitrary importer and distributor
plugins.

Regards,
Nick.

We've been discussing our REST practices over the last few weeks and that's one of the things we're identified that we're not consistently doing but want to.

If you notice it's not in the v2 repo APIs, let me know and I'll fix it; our intention is that they should be doing this.


--
Jay Dobies
Freenode: jdob @ #pulp
http://pulpproject.org | http://blog.pulpproject.org


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]