Throw an Exception for invalid API version

When requesting invalid API version, throw an exception which gets transformed into JSON response.
Fixes #281