API v2

This pull request introduces a new API based on the principles of REST. Authentication is managed by OAuth2. API version 1 is deprecated now.