On Tue, Jun 11, 2013 at 7:43 AM, Dustin J. Mitchell <[email protected]> wrote: > On Tue, Jun 11, 2013 at 9:42 AM, michael hancock <[email protected]> wrote: >> I just noticed that the API version is embedded in the URL like: >> >> curl -H "Accept: application/json" http://puppetdb.domain/v2/nodes >> >> I suppose it's too late to implement this so the client would do: >> >> curl -H "Accept: application/json;version=2.0" >> http://puppetdb.domain/api/nodes >> >> I don't want to have to update puppetdb endpoints registered across various >> systems every time the API is versioned. > > Embedding the version in the URL is a best-practice for REST interfaces[1].
"best-practice" for REST interfaces is widely and wildly debated, and both versions presented are supported by some parts of the world. :) > There should be a /latest/ link that points to the latest API version, > too. If such a thing does not exist in PuppetDB, then I think that'd > be the better feature request to make. This would be a fundamental mistake, however. Why? Because if the API changes, your client isn't going to work! I mean, the API changed, right? It doesn't work the way it used to. Your client, on the other hand, has not changed. The combination of "client expecting old behaviour" and "server delivering new behaviour" is going to work poorly. Just use the version of the API that was current when you wrote your client. If it finally gets removed you are going to be broken, but not as quickly as if the version *changes* and your client breaks - even though the version of the API you expected would still have worked perfectly. -- Daniel Pittman ⎋ Puppet Labs Developer – http://puppetlabs.com ♲ Made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-dev?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
