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

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



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.

--
Nick Coghlan
Red Hat Engineering Operations, Brisbane


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