API v2 - specify API version via headers or in urls

original PR is #3431. it was closed because the `engine` branch has now been merged
into `master`.